How do thermometers actually function? I'm trying to figure out what temperature actually is, and there seem to be a lot of answers floating around:

*

*average kinetic energy per degree of freedom

*a statistical parameter of the Boltzmann distribution

*partial derivative of energy with respect to entropy

*a unique parameter that governs the black body radiation an object emits
and any of these could be fine, except I have no idea how we could possible measure them (except maybe the first, but people generally seem to say that it's actually wrong).
That is, if I take a traditional, thermal-expansion-based thermometer and put it in contact with something, it measures something which corresponds to all of the definitions given above, which is constant at equilibrium, etc. It seems to measure "temperature".
But what is the physical process by which (for example) $\frac{\partial E}{\partial S}$ governs precisely how much the mercury will rise in a thermometer? Why do we believe that "temperature" (the thing a thermometer measures) corresponds so precisely to "temperature" (any of the four definitions given above)?
(and for that matter, if we take $\frac{\partial E}{\partial S}$ as a definition of temperature, how do we define $S$?)
 A: Temperature is a measure based on the most likely value of kinetic energy possessed by the individual particles in a very large ensemble of those particles. The classic "ensemble" in this context is the so-called ideal gas, but the general principle holds for nonideal gases and solids and liquids, with the appropriate corrections which reflect the actual equations of state for those substances.
The kinetic energy of those particles is related to their speed as they vibrate. More vigorous vibrations means more speed, which we measure as an increase in temperature.
That speed increase means the particles exchange greater forces during their collisions, which tends to make them push away harder on one another as the temperature goes up.
This in turn causes the ensemble to expand upon heating.
The liquid mercury in the thermometer is there because its degree of thermal expansion is conveniently large and predictable over a significant temperature range, which makes it a good temperature indicator.
