I thought baked goods which include baking soda should be put into oven immediately, otherwise they won't rise. But some cookie recipes call for cooling the dough in the fridge or even freezing it, which seems would negative the leavening properties of soda. Does it have other purpose or could it be left out?
Baking soda also raises the PH of the product resulting in better browning.
Soda can be left out. Many recipes- especially for chewier cookies- don't call for any leavening besides the eggs. http://www.foodnetwork.com/recipes/alton-brown/the-chewy-recipe/index.html
Cookie recipes often call for the dough to be chilled so that it spreads less in the oven before it sets. This creates a taller, less crispy cookie. Cookie recipes don't typically have very much water in them for the soda to dissolve into. Much of the water is tied up in the butter and won't be available until the dough melts in the oven.
The baking soda helps to develop a small amount of new air cells with carbon dioxide and speeds up the browning process. Resting and cooling the dough allows some carbon dioxide in these cells to escape, but this isn't enough to eliminate the effect of baking soda and make the cookies flat.
Why would baking soda help with leavening? When leavening, new air cells form while mixing the batter, not in the oven. In the oven, air cells only grow. This is why many recipes call for creaming the butter and sugar to add extra air to the batter. As you indicate, conventional wisdom is that baking soda batters leaven quickly, or in technical terms, baking soda has a low "bench tolerance." Especially in runnier batters, baking soda reacts quickly with acids like chocolate, brown sugar, or buttermilk immediately so you need to bake them asap to take full advantage of the carbon dioxide produced. If you wait, the carbon dioxide can diffuse out and the air cells will shrink.
Several considerations counterbalance this problem of gas escaping. First, cookie dough is drier than many other baking mixes, especially after hours of resting (resting causes water absorption), slowing down both baking soda reactions and more importantly slowing down the escape of air. Second, both the baking soda reactions and the escape of air are much slower at low temperatures. Finally, cookies do not require as much leavening as cakes or breads, so some gas escaping is permissible.
As already pointed out, one of the main reasons for adding the baking soda is to raise the PH, which speeds up the browning process. Other secondary considerations include softening chocolate's acidic bite and weakening the gluten in the flour.
Baking soda by itself can be used as a leavener and at medium temperatures (around 80 degrees C) begins to produce a small amount of carbon dioxide in a dehydration reaction. This reaction is too weak to be significant, which explains why you never rely on baking soda alone and always mix it with something acidic.
I've never done any experiments with the amounts of baking soda or amount of time after baking soda is added and how it affects baking, but those could be interesting experiments.
Recommended reading: J. Kenji López-Alt -- The Food Lab: The Science of the Best Chocolate Chip Cookies
From the posting:
As the butter melts and the cookie's structure loosens, this frees up water, which in turn dissolves baking soda. This baking soda is then able to react with the acidic components of brown sugar, creating gases that cause the cookies to rise up and develop a more open interior structure.