As one can find in the Disk Utility/Erase/Security Options section, there are two options for erasing disks securely - zero out 7 times or zero out 35 times. Where these numbers come from?
The 7 and 35 passes very probably come from the paper "Secure Deletion of Data from Magnetic and Solid-State Memory" by Peter Gutmann. There, he described various overwrite patterns targeted at specific hard drive write encodings.
However, the paper, and the 35 passes, are now obsolete, as they were for old hard drive technology, as even the author readily admits. Nowadays, to delete a disk, a single pass with zeroes is enough. Even better, use the SECURE ERASE feature of all modern drives.
For more discussion see the Wikipedia article on the Gutmann method.
Writing information to a hard drive once will thoroughly replace all data that's under the drive head with the new data, but requests to write a particular track won't always cause the head to pass over exactly the same spot. Especially with older drives, various factors like aging and temperature are likely cause the head to pass slightly to the left or right of its "ideal" location. If e.g. information was written when the drive was cold, causing the head to be to the left of its ideal position, and it was later overwritten when it was warmer causing the head to be to the right of ideal, it's possible that enough residue of old information might remain on the left edge of the track to be readable with suitable equipment. Note that overwriting the track dozens of times may not help; depending upon the design of the drive, it might be possible to influence the heat position other ways (e.g. if the information in question is on track 53, accessing track 52 and then 53 may leave the head in a different place from accessing track 54 and then 53, but there's no guarantee that would be sufficient).
Flash drives present a different challenge, because repeated requests to write the same sector will actually cause the data to be stored in different areas of memory. Flash memory can generally be written in 528-byte pages (each holding 512 bytes of data plus some bookkeeping information), but once a page of flash is written it cannot be rewritten until a bulk-erase request is used to clear all of the pages in a rather large area (hundreds or thousands of pages). Rather than erasing a sector as soon as a request is received to rewrite it, the flash chip simply stores the new version and keeps track of the fact that the old one has been superseded. When the number of completely-blank blocks reaches a certain threshold, the drive will try to find find a block with relatively few pages that are still valid, copy those to a completely-blank block, and then erase the block. When a block is erased, any information which had been on it but wasn't copied will be thoroughly destroyed, but if a page happens to reside in a block with hundreds of pages that are still in use its storage may not get recycled even other, more-recently-written pages do.
Neither of those should be considered the least bit secure. Just zero-ing out the data is not enough, no matter how many times you do it.
All so-called secure erase software should follow recommendations such as those given in Secure Deletion of Data from Magnetic and Solid-State Memory by Peter Gutmann. This paper recommends 35 write passes, some of which use random data and some of which use specific patterns, only one of which is all zeroes.