Thermostats work by controlling the flow of hot or cold air and maintaining a set temperature. They operate on thermostat sensors, which sense the room temperature. For more information, read this article on how thermostats work.