It has to do with relative amounts of: kinetic energy and hydrogen bonds.
If you need further information, read about this topic in the chapter on water. .