In a Nutshell : Water freezes because water molecules stick to one another when they get cold and slow down.
Water is strange stuff; in fact, it is one of the strangest substances in the known universe. Its odd properties are essential for the evolution and survival of life on Earth, particularly its ability to form a weak connection called a hydrogen or H-bond.
A water molecule is made up of an oxygen atom connected to two hydrogen atoms, and the way that these atoms share their electrons turns the water molecule into a sort of mini-magnet. Just as two magnets will stick to each other, so a water molecule will stick to other water molecules with H-bonds.
A Sticky Business
In liquid form, the individual water molecules are quite energetic, forming and breaking hydrogen bonds with one another at great speed. In other words, they are sticky enough to adhere as a liquid (not flying off as in a gas) but not sticky enough to stay put. When water cools, its molecules lose energy and slow down, and their H-bonds stay stuck together.
Ice, Ice Baby
Soon, each water molecule is attached to four others in a rigid lattice or network, forming an ice crystal. The lattice is pretty chaotic, however. An average ice cube contains about 60 billion trillion molecules which means that every single ice cube ever created has probably had a different arrangement of water molecules.
Almost any substance will ‘freeze’ if cooled down enough. But why does water freeze so easily? If it weren’t for the H-bonds, water would boil at -90°C (-130°F), and there would be almost no liquid water- and no life – on Earth. In fact the properties of water are a key part of what is know as “The Anthropic Principle” – a series of “cosmological coincidences” about our universe which mean that if even a single variable were off, even slightly, we would not exist.
An even more intriguing question is, ‘why does water expand when it freezes into ice, whereas most substances shrink as they cool down?’ See or article on “Why Does Ice Float”