Why does wiping a hard drive not always remove malware?

Erasing the device is considered the number 1 option when it comes to dealing with malware. You erase all the data on the infected drive with the theory that the malware cannot survive the process.