I believe the yeast consume a lot of O2 during the adaptive phase of fermentation. During the primary phase, they are consuming sugars and producing primarily ethanol and CO2. The amount of CO2 produced is related to the Brix of the wort, or grams of sugar per 100ml of wort. A typical 1.050 SG wort has a Brix of 12.37. The conversion to CO2 is 48.9% (each glucose molecule is reduced to two ethanol molecules and two CO2 molecules- molecular weight of glucose is 180 and molecular weight of CO2 is 44. (44X2)/180 = 48.8888.) Thus, for every 100g of sugar (12.37 in the 1.050 wort.) 6.05g of CO2 is produced. Since this CO2 production reduces the amount of solution, the final beer will produce 6.44g of CO2 per 100ml of wort (6.05/(100-6.05)*100). Or, we can say each liter of wort produces 64.4g of CO2. Thus, for five gallons of wort (18.93 liters) roughly 1200g of CO2 are produced. Remember that one mole of CO2 weighs 44g, so 27.7 moles of CO2 are produced. And each mole of gas at STP occupies 22.4 liters (our beer is warmer that standard temperature with an airlock and 65C fermentation temp, but suffice it to say gas occupies more volume at higher temperature) or >619 liters of CO2 are produced (assuming 100% attenuation.)
This gas has to go somewhere, so it gradually fills the headspace of the fermentation vessel and eventually makes its way through the airlock. Since this is not done all at once, the O2 in the headspace air (~20%) is gradually diluted and displaced through the airlock along with the Co2, N2 and other gases in the air. Over time, the air becomes so dilute in the headspace as to become negligible, and some of the 619 liters of CO2 that were produced remain (depending on the headspace volume.) I could use calculus to approximate the volume of air that remains, but I think it is very small. I am also assuming that yeast consumed the O2 dissolved in the wort during the adaptive phase. Some of the CO2 will remain dissolved in our beer (about 0.9 volumes at 65F), as bottle priming calculators are aware.
Of course, if open fermentation is allowed, these calculations become meaningless. And every time you remove the airlock, air is allowed to mix with the headspace CO2, as muse states in his original post.