Water vapor will only condense onto another surface when that surface is cooler than the dew point temperature, or when the water vapor equilibrium in air has been exceeded. When water vapor condenses onto a surface, a net warming occurs on that surface. The water molecule brings heat energy with it. In turn, the temperature of the atmosphere drops slightly. In the atmosphere, condensation produces clouds, fog and precipitation (usually only when facilitated by cloud condensation nuclei). The dew point of an air parcel is the temperature to which it must cool before water vapor in the air begins to condense. Condensation in the atmosphere forms cloud droplets.
Also, a net condensation of water vapor occurs on surfaces when the temperature of the surface is at or below the dew point temperature of the atmosphere. Deposition is a phase transition separate from condensation which leads to the direct formation of ice from water vapor. Frost and snow are examples of deposition.
There are several mechanisms of cooling by which condensation occurs:
1) Direct loss of heat by conduction or radiation.
2) Cooling from the drop in air pressure which occurs with uplift of air, also known as adiabatic cooling.
Air can be lifted by mountains, which deflect the air upward, by convection, and by cold and warm fronts. 
3) Advective cooling - cooling due to horizontal movement of air.