Yeast can respire in both ways. Yeast gets more energy from aerobic respiration, but when it runs out of oxygen it does not die. It can continue to respire anaerobically, but it does not get so much energy from the sugar. Yeast produces ethanol when it respires anaerobically but if any was produced in bread-making, it would evaporate away fully in the baking process.
The two word equations for years are:
Glucose + Oxygen = Carbon Dioxide + Water + Energy
Glucose = Carbon Dioxide + Ethanol + Energy