Some growers keep their reservoir and root zone as sterile as possible, using additives like hydrogen peroxide or calcium hypochlorite. Others dose beneficial bacteria intended to outcompete bad stuff, like Bacillus amyloliquefaciens (Hydroguard, Southern Ag Garden Friendly Fungicide).
Algae can use the same nutrients as the plants, but can often be controlled by excluding light. Other bad microbes are generally heterotrophs, so they're feeding on something else (like dead algae or dead roots).