A thermistor varies its resistance with temperature due to its unique semiconductor material composition. As the temperature increases, the thermal energy causes more electrons to be freed, leading to higher conductivity and therefore lower resistance. Conversely, as the temperature decreases, the reduced thermal energy causes fewer free electrons, resulting in lower conductivity and higher resistance. This property enables thermistors to be used for temperature sensing and control in various electronic devices and systems.