Fermentation is anaerobic respiration. It can occur in both eukaryotes and prokaryotes. As stated before, the 4 total ATP are produced during glycolysis. Fermentation doesn't consume ATP. NADH is converted to NAD+ in order to obtain lactate or ethanol ( depending on the organism) from pyruvate. This regenerates NAD+ so it can be used in glycolysis again to obtain the two net ATP.