One of the first things it is important to note is that fermentation is an anaerobic process, meaning it does not use oxygen, but it is not anaerobic respiration. The difference between the two is that fermentation does not use an electron transport chain. Essentially, fermentation is a process that creates chemical energy without cellular respiration. There are two kinds of fermentation: homolactic and alcoholic.
At some point in time, it was necessary for nature to create a way for an organism to make energy without oxygen. So, nature needed to figure out how to keep NAD+ plentiful within the cell. To solve this, instead of transferring electrons to the electron transport chain, like in cellular respiration, electrons are transferred to pyruvate to oxidize NADH back into NAD+.