Its the expansion of the contact plate due to heat which makes it bend and make the contacts for electricity contacts separate and thus switch off the power supply to the system.
Once a thermostat has been set to the desired temperature, the unit will run until that temperature has been reached. The thermostat has an internal thermometer to let it know when the temperature has been reached.