Let us be clear - virtually all common lifeforms can provide energy for themselves by both respiration and fermentation.
Respiration uses oxygen to efficiently extract all the energy from the chemical bonds found in sugar like substances.
Fermentation does not use oxygen and hence can only extract some of the energy from some of those chemical bonds.
Many bigger beings, like us humans, only use low efficiency fermentation when we can't get sufficient oxygen for high efficiency respiration - the classic case for humans is during long, hard, fast physical activity like running in the Boston Marathon.
But why then do a whole lot of 'primitive' microbes perversely continue to use low efficiency fermentation --- even when lots of oxygen is available ?
This is the so called Crabtree Effect - first widely noted by university scientists post 1929.
(And first noticed by brewing types back in 10,000 BC !)
The discovery of this fact by chemists during the Age of Progress was the key reason why my parents and I were duly taught in school that beings like the fungus were but primitive relics of simpler, stupider times --- living fossils.
Today the scientific consensus is that at the very beginnings of Life, simple respiration came first and complex fermentation came later !
Admittedly, this news hasn't reached most scientists not involved in this specialized area of research and the bulk of them still think of fermentation as simple and stupidly inefficient.
We humans greatly profit from this 'stupidity', of course.
Because instead of the sugars being reduced to low energy CO2 and water 'waste', it goes out as relatively high energy ethanol 'waste' --- beer, wine and spirits. And the secret that makes bread rise.
But of course chemists are not really evolution experts.
Because real evolution experts must explain why such stupid behavior has been so well rewarded by the natural selection gods.
After all, fungus having been on earth for hundreds of millions of highly successful years versus the human chemists' very brief sojourn on Earth.
We can start by noting fungus only move to fermentation mode when the amount of available sugar to eat is high, regardless of the amount of oxygen about.
Going at that mountain of sugar with oxygen yields the most energy per unit of sugar, but it takes a lot of time and needs a lot of cellular machinery and cellular surface space.
Fungus can't really increase their factory size* endlessly, unlike our human companies.
Instead they shift to using their existing limited cellular surface space and machinery so as to increase their energy-gaining throughput,in terms of units of time, even if it results in a low yield per unit of sugar.
So they certainly do waste the sugar, but after all there is lots and lots of it about ---- and in doing so, they gain more energy per minute for themselves than by the slow, bulky but efficient respiration route.
As the lucky individuals closest to the mountain of sugar, they bulk up quickly all set to reproduce lots of spore children when the time comes --- even if their reproductive success comes at the cost of denying useful sugar to their fungal distant cousins.
(During the process of bulking up, the fungus does use some of the readily available oxygen all right - but as a structural material rather than as part of an energy extracting process.)
As is usual, once scientists (and economists) move beyond a reductionist way of viewing reality - looking instead at the whole picture at the top level of an ecosystem, the benefit of behavior that seems stupid and 'inefficient' at the level of the reductionist chemists' atoms and molecules, becomes much clearer...
* It is known that microbes do change the shape of their cells to a limited extent, to alter their surface to volume ratio to economically maximize food intake in times of extreme starvation or extreme abundance : long and thin, small and round, large but flat & shallow , etc.