Read and scale
An ADC cannot measure volts on its own. It compares the pin with a reference voltage, VREF, and reports what fraction of VREF it sees, as a whole number from 0 to 1023. On an Uno, VREF is the 5 V rail by default.
The datasheet's rule is raw = Vin × 1024 ÷ VREF. So 750 × 1024 ÷ 5000 = 153.6, and the ADC keeps only the whole part: analogRead(A0) returns 153.
10 bits give 1,024 steps, so one step, called 1 LSB, is VREF ÷ 1024 = 4.88 mV. Smaller changes are invisible: 750 and 751 mV both read 153. For the TMP36 one step is about half a degree.
Run the rule backwards with the same VREF: mV = raw × 5000 ÷ 1024. 153 gives 747 mV. The L in 5000L makes it long maths: 153 × 5000 = 765,000, far past an int's 32,767.
The TMP36 gives 500 mV at 0 °C plus 10 mV per degree, so t = (747 − 500) ÷ 10 = 24.7 °C. The room is really 25 °C: the reading can only be as fine as one step.
Change the reference
analogReference(INTERNAL) swaps VREF for the chip's built-in 1.1 V. The same 1024 steps now span 1.1 V, so one step is 1.07 mV, about a tenth of a degree. The same 750 mV now reads 698.
Leave 5000 in the scaling and 698 becomes 3,408 mV: nonsense. Scaling must use the reference you read with: 698 × 1100 ÷ 1024 = 749 mV, so 24.9 °C. That is within 0.1 °C.
Range and accuracy
Anything near 1.1 V or above reads 1023. The TMP36 reaches 1100 mV at 60 °C, so this thermometer tops out there: 70 °C reads the same 1023. Pick the smallest VREF that still covers your whole signal.
The maths trusts VREF. Back on the 5 V reference, suppose the rail is really 4.8 V: 750 mV reads 160, and the code says 781 mV, 28.1 °C, 3 degrees off. The internal 1.1 V can be 1.0 to 1.2 V, so calibrate.
What happens
;; step 1/9 · measure
ADC analog-to-digital converter
VREF the reference voltage: the length of the ruler
Uno default: AVCC = 5 V
pin A0 sees 750 mV from the TMP36 (25 °C)
answer: a whole number 0 .. 1023 (10 bits)
The ATmega328P datasheet gives the result as ADC = VIN × 1024 / VREF, where 0 is ground and 1023 (0x3FF) is VREF minus one step. So code ÷ 1024, not ÷ 1023, turns a reading back into a fraction of VREF. One step is not the whole error. The datasheet lists ±2 LSB absolute accuracy for the ADC itself, and the TMP36 is only accurate to about ±2 °C. A fine step shows small changes; it does not make the sensor more correct.