What keeps the different gases mixed in the atmosphere?
It's because gases also diffuse. If you separate two gases of different densities by a horizontal membrane, and then slowly remove the membrane, then the interface will diffuse. You can try this with bromine and air, for example&nbsp;&ndash; the bromine will stay at the bottom (easily visible because it's brown) and the air will stay at the top, but the interface will be diffuse. The bromine will largely stay at the bottom because it's significantly heavier than the air, but the diffusive mixing will be much stronger if the density difference is smaller&nbsp;&ndash; as is the case with nitrogen and oxygen, which are of course not very different in density.

While the effect above just considers mixing due to molecular diffusion, the atmosphere of course also vigorously convects due to the effects of thermal heating (and humidity differences). Both also turn over the atmosphere and mix it.

That said, the composition of the atmosphere does change with altitude. See, for example, here. The thing is that the thickness of layer corresponding to the blurry interface between bromine and air is about as thick as the entire atmosphere, and therefore hard to distinguish from other effects (such as ionization) that change its composition with altitude.