I'll say it real simple for you because this is literal elementary School teaching in America but I don't know what country you come from and if you even have schools-
Liquid and frozen water are heavier than air. Gaseous water is lighter than air. When water evaporates it rises up into the clouds, which is colder. That water then begins to freeze. When enough of the water freezes together to be heavier than air it falls.
If it's falling somewhere warm, the frozen water melts and becomes rain. If it's falling somewhere cold, the frozen water stays frozen and is snow.
Nothing is happening "whenever it wants to", it's a natural cycle of evaporation, condensation, and crystallization.