To understand why water condenses on a cold drinking glass, you need to know some basic properties about water. Water alternates between liquid, solid and gas phases, and the phase water is in at any given moment depends largely on temperature. According to the U.S. Geological Survey's website, water molecules that evaporate into the gas phase have absorbed heat energy, and these energetic molecules therefore stay far apart. Condensation is the opposite of evaporation. It's the process by which water molecules lose heat energy and start sticking together to change water from a gas back to liquid.
The Dew Point
Water is always evaporating and condensing, notes the USGS. As long as the evaporation rate exceeds the condensation rate, the water molecules can't stick together long enough to form liquid. When the condensation rate exceeds the evaporation rate, the molecules start sticking together, and you get liquid water. The temperature point beyond which the condensation rate exceeds the evaporation rate is called the dew point.
Dew Point Varies
The dew point varies depending on the temperature of the air and can be used to calculate relative humidity, the amount of moisture currently in the air compared to the total amount it can carry. Hot air increases the rate of evaporation, and hot air can hold more water vapor than cold air, which is why hot summer days often feel so muggy. But there is an upper limit to how much water vapor the air can hold. As the air nears its maximum water-vapor carrying capacity, the rate of evaporation slows compared to the rate of condensation.
Bring in Your Glass
Water will condense as liquid on any surface that has a temperature below the dew point. If the surface temperature of your cold glass is below that of the dew point, you will have water condensing on it. The exact same sequence of events causes dewdrops to form on plant leaves.
Water, Water Everywhere
Water vapor is always present in the air, even on perfectly clear days, notes the USGS. Depending on weather conditions, air heated by the sun rises upward, pushing water vapor into the cooler upper levels of the atmosphere. The cooler air slows the evaporation rate to a point where it is less than the rate of condensation. As a result, the water molecules condense around tiny airborne particles of dust, salt and smoke to form tiny droplets that grow by collecting more water molecules.
Clouds and Rain
Eventually the droplets become big enough to form clouds that you can see. Some of the droplets near the bottom of a cloud may become big enough that they can no longer stay airborne. They coalesce into raindrops that fall to the ground. Even though a cloud may weigh many tons, its mass is spread over a vast volume of space, making its density (weight per unit of volume) so low that the rising air that formed the cloud can keep it aloft.