You need a fermenting agent, food for it, and the right circumstances.
Fermenting agents may be bacteria or yeast.
Food is usually (but not always) some kind of sugar.
Circumstances depend on the fermenting agent. Temperature is important (low temperatures will slow them down, high temperatures will kill them), also the presence or absence of oxygen, acidity, other chemicals.
Example: Alcohol fermentation
Fermentation agent is yeast.
It needs some salts in the solution and uses up the dissolved oxygen only to multiply. After that they feed (without oxygen) on simple sugars and produce carbondioxide and alcohol as waste products. If the alcohol level gets too high, they die by their own waste.