I am thinking of Easeus Partition Recovery, and TESTDISK - there must be several more.
A friend who did some recovery years ago told me that the first sector of a partition ends with 55AA (hex) and shortly before that is a byte string containing FF and FE and the partition type, e.g. 83 for ext3.
He could not remember the details. I presume that the partition finder rescue programs search for these byte strings. And I would guess that a smart program would know what a root directory looks like in NTFS, FAT32, Mac, linux et cetera and also see if that is following any "start sectors" encountered.
Is this how it works?
(I suppose a linux swap partition would contain random crap and be somewhat harder to identify).