Most of the things get larger when they warm as well as smaller when they become cold (water is an example: it expands when it warms and when freezes also). The thermostat utilizes this idea to switch a power circuit on and off. The 2 most common forms utilize gas-filled bellows and bimetallic strips.