This is maybe a more precise way of asking, "what happens to left over batter in the fridge?" This question might have to approached per leavening agent.
Chemical leaveners all work the same way. You have a basic salt (like sodium bicarbonate) and an acid (incorporated in baking powder, like cream of tartar, or coming from the dough itself, like a baking soda leavened cake with yoghurt in the batter). You have probably seen the reaction at some point in science class, but if not, go mix a teaspoonfull of baking soda with a teaspoonfull of vinegar and watch.
In this reaction, the acid reacts with the base, creating new compounds. Some of these compounds are gaseous, so they make a foam in your baking soda - vinegar experiment. When baking, these bubbles of gas stay in the batter and get trapped there when the batter sets, resulting in a sponge-like structure.
To start the reaction, you need both the base and the acid. When using baking soda, you have no reaction before it is added to the acidic batter. Baking soda is a mix of baking powder and what I called an acidic salt, but in reality, the salt itself is not acidic. It forms acidic solutions with water. Remember, an acid is a proton donator. pH is a measure for the amount of protons swimming around free, waiting to react with something non-acidic. A salt has a firm structure, it is an ionic grid. No protons are swimming around in a salt, they stay at their places. Dissolve the salt, and they start swimming and become available for reactions. So with baking powder, too, the reaction starts once you mix the baking powder with the moist ingredients. This is the effect of moisture and the reason why batter goes flat.
The coolness in the fridge doesn't have much of an effect. If anything, it probably slows down the reaction somewhat, but not enough to stop it.
In a nutshell, what happens with the batter in the fridge is exactly the same thing that happens with the batter in the oven. Only as you are not baking it, the bubbles don't get trapped in the setting dough, but swim around until they reach the surface and leak into the air. This continues until the reactive compounds are exhausted. When you take the batter out later, the reaction is over, because there is nothing left to react, and it does not rise in the oven, because the rising is already over.