Why does deleting a partition cause data to be lost?

Why does deleting a partition cause data to be lost?

It doesn't.

I mean, well, sometimes it doesn't.
Sometimes it does.
It depends on what software you use.

In theory, there is no good reason why deleting a partition needs to result in losing the data. After all, a partition, is basically just a set of numbers, located in a specific spot (called the "partition table"), which specify the boundaries of the partition. In theory, changing those numbers to zeroes wouldn't cause a change in the other sectors that are inside the boundaries of the partition. So, in theory, your filesystem volume should remain in tact (unaltered).

However, there's a notable exception to that theory.

For whatever reason, (at least some versions of) MS-DOS FORMAT.COM expected that the first sector of the new filesystem volume contains bits cleared to zero (before FORMAT runs). Clearing those bits to zero would be a sensible task for FORMAT.COM to do, but instead, FORMAT.COM just expects that this task gets done.

In order to accommodate this weird expectation, MS-DOS FDISK.EXE (the partitioning software) would erase the first sector.

The most sensible tool would be FORMAT. Linux man pages @ die.net: fdisk states, “we consider this a bug in DOS FORMAT and DOS FDISK.” However, since both of those pieces of software came with the same operating system, this arrangement tended to work out just fine. People wouldn't be aware of this situation if they were simply following the instructions in MS-DOS's manual.

Despite however improper this arrangement might seem, some other operating systems would typically support doing the same thing, in order to be rather compatible with MS-DOS. This is because MS-DOS was popular (prior to Windows 95 and subsequent versions of Microsoft Windows), so other operating systems sought compatibility with MS-DOS.

Make no mistake: You can use some software (e.g., OpenBSD's fdisk) to "erase" a partition (which, at least for MBR-based partitions, is defined as setting the partition Type Identifier to zero) and not lose any data within the partition. If you recorded the settings (boundaries, type identifier), you can re-write those values, and all the data in the partition remains in tact.

So, whether the data at the start of the partition gets mutilated, or not, depends on what software you use. (Or, possibly for some software, what settings/options you choose.)