On most devices, the temperature sensor is located near the processor. It helps to regulate the processor's temperature by monitoring how much heat it's emitting. If the processor gets too hot, the device will usually throttle back its performance to try and cool things down.