When a liquid is cooled, the average energy of the molecules decreases. At some point, the amount of heat removed is great enough that the attractive forces between molecules draw the molecules close together, and the liquid freezes to a solid.
hope this help!