The process of a gas changing to a liquid is called condensation, and for condensation to take place, the environment has to reach maximum vapor pressure, generally through a lowering of temperature in the case of the water cycle. Because pressure varies inversely with temperature, as temperature decreases, pressure goes up, causing the gas molecules to move with progressively less kinetic energy. Eventually, liquid vapor and droplets form, and the gas begins to condense.
Clouds, fog and the "sweat" that builds up on the outside of a glass with a cold drink are all examples of condensation. Molecules in the gaseous state have a more random arrangement than those in a liquid state. As the vapor pressure builds, the gas molecules are forced into a more structure arrangement. The slowing in motion leads to a release of heat, which drops the temperature even further.
As condensation continues, the water droplets adhere to one another. In a situation where someone's reading glasses are fogging up, the process stops fairly quickly. In a large cloud, the process continues, in many cases, often to the point where precipitation begins. The water at the bottom of a cloud begins to fall, sending water further on its way around the water cycle.