Most modern file systems like NTFS for windows have a large section of the drive which is for writing data and then they have a file table or index which contains the meta data about the file, such as file name, location on disk (virtual) and location of disk (actual/physical)
Most basic deletes do not actually delete the data, all that happens is the file table is updated to list the space on the disk where the file exists is now "empty" and can be written to. As long as no other software writes to that part of the disk (just luck really) then the file is still essentially there and can be potentially recovered by software designed to look for file fragments.
Secure delete which certain types of software support, both remove the entry in the file table, but they also write data into the space on the drive where the file is, meaning no recovery is possible, sometimes its just Pseudo random data, sometimes it's just zeros.
The last piece of the puzzle is that due to the physical nature of magnets setting bits to 0 or 1 not being precise but being within some kind of tolerance, you can measure the strength of the field of each bit and try and infer what it used to be previously, this has some statistical likelihood of getting each bit correct which isn't very high, so there's possible attacks you can do with sophisticated software to attempt to recover partial data from drives which have had dummy data written on top of the original data.
Typically for really secure erase procedures you might do a data write several times, this is where people tend to get a bit paranoid and start doing things like 7 passes or 35 passes. In reality that's completely overkill, there are some publish standards by things like the US Navy and Army for top secret information which tend to aim for 1-3 passes. I don't think there's been any published work recovering any significant amount of data for 2 or more passes.