Cloud formation is mainly caused by the cooling of air as it rises and expands in the atmosphere. Different types of clouds are formed due to variations in temperature, humidity levels, and air pressure at different altitudes. Factors such as air composition, topography, and weather patterns also play a role in determining the type of clouds that form in a specific location.