And yet, there are nitrogen-fixing species that are obligate aerobes, or even oxygenic. How do they do it?
Azotobacter has been shown to increase its respiration while its growth efficiency decreases as oxygen increases, seeming to waste the oxygen: this has been called "respiratory protection." The mechanism for this is not simple though; it involves carefully regulated shifts in respiratory components throughout the whole catabolic system.
Azotobacter also has the ability to reversibly inactivate its nitrogenase if respiratory protection is not possible (such as in carbon-limited conditions, or upon a sudden increase in oxygen). This seems to depend on FeSII protein (aka Shethna), though it is suggested that there may be other mechanisms.
When oxygen is too high and cells' supply of fixed nitrogen runs out, production of nitrogenase may be regulated (no sense making an enzyme when it can't function). This regulation may be done by the products of nifAL genes.
Azotobacter also produces gummy alginate which might have a role in protection from oxygen, but non-gummy strains (such as CA) have been isolated that don't seem especially oxygen-sensitive. I wonder if they have higher rates of respiration though, or if they might be more sensitive in carbon-limited conditions.
Nitrogenase also produces hydrogen gas, whether or not it's reducing anything else. This reaction seems separate from the nitrogen fixation reaction, since some things can inhibit the latter without inhibiting the former. Acetylene seems to inhibit hydrogen production though. Nitrogen can't compete with hydrogen for electrons completely, even with pure pressurized nitrogen; the enzyme always produces at least 1 mol hydrogen for each mol nitrogen gas fixed.
Of course, this hydrogen usually doesn't just escape; Azotobacter and other diazotrophs recapture it with their uptake hydrogenase. The exact purpose this serves is not clear though.