This is because cool air holds less water vapor than warm air, so the vapor condenses into either liquid or ice. These condensed particles are what we see as the cloud. When a cloud forms at relatively warm temperatures, the particles are usually tiny liquid drops. At very low temperatures, the particles are usually ice. The temperature in the Earth's atmosphere tends to decrease with increasing altitude and the most common way to form a cloud is to force air to rise to a cooler region.
Thermal updrafts are one source.
As sunlight warms the surface of the Earth, the air closest to the ground gets warmed as well. Since warmer air is less dense, it tends to rise, and regions of upwelling air form. Another way to force upward motion is when a horizontal wind encounters a mountain. The blowing air gets redirected up the mountain side. The cooler air is denser, and tends to stay near the ground, while the warmer, lighter air rides up and over the cooler mass.