One thing that is very confusing for me right now is the dynamics of when to isolate the contents and when to aerate it. Like as soon as you finish boiling it's recommended to put a lot of oxygen by shaking or stirring in order to create a good environment to the yeast. But as soon as you do this you put an airlock in the bucket for fermenting. I don't get this. I understand this is for preventing bacteria and etc contamination. But as you 'injected' oxygen for the yeast prior didn't you also put a lot of undesired microorganisms? An overall explanation of when is desired to have air in your beer and when is not a good idea is very welcomed. Thanks!
The factors determining oxygenation are yeast health vs taste of the beer. Ever tasted a starter culture, or a bottle that was only bottled a couple days ago? They will be full of acetaldehyde, the cidery/green apple flavor of oxidized beer.
It is correct that the yeast needs some oxygen for replication and general healthy-ness, but at the end of the ferment, we (the humans) want ethanol and not acetadlehyde. In the absence of oxygen the yeast (with alcohol dehydrogenase and lot of other enzymes) will convert the acetaldehyde to ethanol.
In the presence of oxygen, the reaction will reverse as the yeast try to make energy from the ethanol. Given enough time all the ethanol would be converted to energy, with acetaldehyde being the first step in the conversion.
In regards to open fermentation, it works because foam and CO2 are keeping most of the oxygen out, and the Crabtree effect: in the presence of enough sugar, anaerobic metabolism happens anyway. The important thing is that the open-fermented beer gets put in a barrel before its too late.
You've already understood the general practice. Air (really oxygen) is needed in the wort prior to pitching so the yeast can grow and replicate. After pitching, a sealed environment is desired. I think the reason its OK to aerate with air (vs, say, pure O2) is that the yeast, if healthy, will usually overwhelm anything else trying grow in the fresh wort. However, once fermentation slows, other microbes could gain a foothold.
Also, and this is the crux of the answer, once the beer matures, O2 will hasten the breakdown (oxidize) of many of the nice flavor compounds that we all enjoy and lead to further off-flavors. Again, without the yeast to clean the oxygen, this is a risk.
All that said, there are breweries that ferment in open tanks. They generally have high krausen and/or use positive pressure rooms to keeps out beasties, but not all.