How do software programs determine the HDD temperature?
The hard drive has a temperature sensor (or multiple temperature sensors - they might be used for internal control, self-test etc...) inside, and this data is passed through SMART (in fact, this is a standardized SMART parameter).
No, the temperature monitor is embedded into the HDD. It's a more recent addition and you will only see it with some of the newer SCSI disks. Anything older than a few years won't have the sensors.
It's actually a part of the S.M.A.R.T. suite that reports around 30 attributes. (http://www.hdsentinel.com/smart/index.php)
The software just pulls it from the hardware. You won the argument.
all the software uses statistics about heat from the RPM info"
Hard disk drives spin at a constant rate (usually 5400 RPM, 7200 RPM, 10000 RPM, or 15000 RPM). So the statistics on RPM info will probably be of little value for determining temperature.