Why does water expand when it freezes?
Why does liquid water have a density maximum?

Most liquids have a quite simple behavior when they are cooled (at a fixed pressure): they shrink. The liquid contracts as it is cooled; because the molecules are moving slower they are less able to overcome the attractive intermolecular forces drawing them closer to each other. Then the freezing temperature is reached, and the substance solidifies, which causes it to contract some more because crystalline solids are usually tightly packed.

Water is one of the few exceptions to this behavior. When liquid water is cooled, it contracts like one would expect until a temperature of approximately 4 degrees Celsius is reached. After that, it expands slightly until it reaches the freezing point, and then when it freezes it expands by approximately 9%.

This unusual behavior has its origin in the structure of the water molecule. There is a strong tendency to form a network of hydrogen bonds, where each hydrogen atom is in a line between two oxygen atoms. This hydrogen bonding tendency gets stronger as the temperature gets lower (because there is less thermal energy to shake the hydrogen bonds out of position). The ice structure is completely hydrogen bonded, and these bonds force the crystalline structure to be very "open", as shown in the following picture:

The pictures on this page are provided courtesy of the MathMol project at the NYU/ACF Scientific Visualization Laboratory.
Information about MathMol can be found here.

In the following two pictures, the first shows a typical structure of liquid water, while the second is an ice structure; note the extra open space in the ice.

It is this open solid structure that causes ice to be less dense than liquid water. That is why ice floats on water, for which we should all be thankful because if water behaved "normally" many bodies of water would freeze solid in the winter, killing all the life within them.

Water's "density maximum" is a product of the same phenomenon. Close to the freezing point, the water molecules start to arrange locally into ice-like structures. This creates some "openness" in the liquid water, which tends to decrease its density. This is opposed by the normal tendency for cooling to increase the density; it is at approximately 4 degrees Celsius that these opposing tendencies are balanced, producing the density maximum.

Updated December 3, 2013