Fermentation is the conversion of sugars into alcohol using yeast. Put simply, yeast eats sugar then produces two waste products: alcohol and carbon dioxide.
C6H12O6 is the molecular formula for sugar. Various types of sugar are found in a liquid before fermentation. When making alcoholic drinks, this yet-to-be-fermented liquid has various names. It's called 'must' in wine making, 'wort' in beer brewing, and 'wash' in spirit distilling.
Once the must/wort/wash is created, the drink maker pitches yeast. For every molecule of sugar consumed, yeast creates alcohol (C2H5OH) and carbon dioxide (CO2). Hey presto!