The thermostat is immersed in a stream of cooling water produced by a water pump. It is tightly attached to a housing so no water can bypass it. A thermostat is really a temperature controlled valve. By strategically placing an on-off valve in the flow of water, it can divert water to the radiator, or keep it circulating in the block depending if it is open or closed.
When a metal heats up, it expands. Conversely, when a metal cools down, it contracts. Thermostats use this property to control a damper. Most thermostats have a spring attached to a damper plate. The damper plate is firmly seated on a base. When hot water flows over the thermostat, the spring starts to expand. Because of the expansion, it lifts the damper plate off its base. When the plate lifts off the base, the thermostat is open and allows hot water to flow through it to the radiator. The radiator then cools down the water. When the water is cooled down, the spring contracts, closing the damper.
Another kind of thermostat is the electric thermostat. Rather like the spring controlled damper, it controls an on-off switch. The spring is placed in the water flow. In a car, the switch is wired in to a cooling fan in front of the radiator. When the spring expands due to the water being too hot, it trips the switch from off to on. This turns on the cooling fan. When the water temperature drops, the spring contracts, turning the switch off, which in turn turns the fan off.
You can see how a thermostat works by performing this simple experiment. Obtain a car thermostat, readily available at any auto parts store. Notice it has a spring, attached to a flat plate on one side. Place the thermostat in a small pot. Pour water in the pot, so that it just covers the thermostat. Place the pot on the stove, and start boiling the water. Notice as the water starts to boil, the spring contracts and opens the damper. The University of Alaska recommends this method to test thermostats in a car. If the spring does not move the damper, the thermostat is bad. If this experiment is done by a child, adult guidance is recommended for safety.