Most organisms oxidize carbohydrates such as glucose to release stored energy used in the production of ATP, or utilize the breakdown of other molecules such as lipids to similar products of sugar catabolism.

This oxidation occurs either by respiration, involving the complete breakdown of sugar to the low energy products carbon dioxide and water, or by fermentation, the partial breakdown of the sugar to substances such as acids or alcohols that still retain carbon-to-carbon bonds and thus retain much of the energy stored in the original sugar molecule.
 

Most cells begin the process of sugar catabolism via the Ebden-Meyerhof pathway, commonly called glycolysis.  This pathway occurs in the cytoplasm of the cell and is anaerobic.

The end product of glycolysis is two three-carbon molecules of pyruvic acid.  These can either be completely oxidized during later steps in the respiratory process or serve as the final acceptors of hydrogens and electrons during the anaerobic  processes of fermentation.

Though 4 ATP are generated as a gross gain during this process, two are used during the initial stages.  Therefore the real net gain to the cell is only 2 ATP.