Mechanical thermostats make use of the expansion rate of different metals. By welding two flat pieces of dissimilar metals together to make a bar, movement will occur favoring one side or the other as the bar is heated or cooled. Using the bar as a lever, with one end fixed in place, movement of the other end from temperature changes can be used to switch the heating or cooling on. Some manufactures attach glass bulbs with a bead of liquid mercury and electrical contacts inside to the lever for more accurate temperature sensing and switching. Correct mounting of a mercury bulb thermostat is critical to it's accuracy.
Dust can also affect performance.
Mechanical thermostats are usually adjustable, but require special tools. Most electronic thermostats are programmable. They use a thermistor or special sensor to determine room temperature and circuitry to switch the heating or cooling on and off. Some electronic thermostats are adjustable. The installation instructions will either explain the procedure or offer a phone number for technical help.