Sun needs to shine on the ground and heat a layer of air close to Earth's surface. When the air close to the surface gets warm enough and warmer than the air above it, it begins to rise up into the atmosphere. The higher the air rises, the colder the atmosphere gets. At a certain level, the warm air will begin to cool and as a result, the water vapor in the air condenses, forms a cloud, and then we see rain.