This is from my article some time back for another site. You need some definitions to follow this, so I will add these too.
Bacterial blooms
These are most common in new tanks. Established tanks rarely have them, except when the balance is disturbed [explained below]. Heterotrophs appear sooner and faster. They build many of the biofilms that all bacteria use to adhere to surfaces, and they reproduce much faster, around 15 to 60 minutes, compared to hours for the autotrophs. So if heterotrophs cause the bacterial bloom in a new tank, and yet there is very little if any obvious organic waste, how? Well, when water is dechlorinated, it can suddenly support bacteria, and the "organic waste" in the water itself feeds the heterotroph bacteria and it very rapidly reproduces and clouds the tank milky white. This will occur in fishless cycling with just ammonia. It is usually less likely, or will be minimal by comparison, with live plants because they assimilate nutrients from organics.
As was previously mentioned, heterotrophs are facultative anaerobes—unlike autotrophs which need oxygen—so they can switch between aerobic and anaerobic depending upon the environment. This is why they can kill so many nitrifying bacteria in filters when the filter is allowed to get clogged. When heterotrophs bloom in the water they switch to being aerobic and consume vast amounts of oxygen. This is the real danger of a bacteria bloom, as it can starve the fish of oxygen. Increasing aeration may be advisable.
In an established tank, a bacterial bloom is caused by something that upsets the biological balance by increasing the organic matter too quickly, such as overfeeding, excessive decaying plant and animal matter, excess waste from overcrowding, etc. Here, the heterotrophs quickly reproduce by feeding on this organic matter. This produces ammonia as a by-product, and the sudden surge in ammonia overtakes the nitrifying bacteria that need time to "catch up." Live plants again help here, as they can assimilate and/or take up considerable quantities of ammonia faster. Note that the bacterial bloom causes the rise in ammonia, not the opposite as some may think.
A water change is not recommended to clear a bacterial bloom. When the free-floating heterotrophs are removed, the others will reproduce even faster to compensate, thus worsening the bloom. If left alone, they usually dissipate in a few days. In an established tank, however, the source of the problem should be removed. Clean the gravel, remove decaying matter, don’t overfeed, reduce overstocking, etc. And be aware of the oxygen shortage issue.
Heterotrophic bacteria cannot synthesize their own food so they need organic material such as fish waste, dead bacteria, fish and plant matter, etc., and while some are aerobic, many are facultative anaerobes, meaning that they can survive in either the presence or absence of free oxygen. Anaerobes are organisms that do not require free oxygen for growth. This has significant consequences in aquaria.