So they do—they just don’t remain there, they get kicked back up.

What is at stake is that you carry a subtle contradiction in your head, assuming you got some pieces of wisdom from your physics classes but not others.

One side of this is the minimum energy principle. Like, this is common sense, you leave a basketball bouncing in your driveway and you expect it to stop somewhere, probably (if it's not a perfectly flat blacktop) downhill of wherever you started it. Heck if you've had a hoop in your driveway you probably have a reflex to run after the ball when it touches ground, otherwise it'll eventually find the road and roll very far away as it chases the downhill. That's the minimum energy principle, dynamic friction reduces kinetic energy in a system while forces tend to make potential energy into kinetic energy, so you would expect if you just leave the system alone it ends up at rest at some minimum of potential energy.

The other side of the contradiction is that we tell you that energy is conserved cannot be created or destroyed. If you are very lucky, we tell you that there is a way of phrasing the laws of physics such that energy conservation is the same as saying that the laws of physics are the same today as they are tomorrow—we call this “time translation symmetry” and did the theorem that connects continuous symmetry is to conserved quantities is Noether’s Theorem if you are looking for something to google here.

The only way to resolve the contradiction is to say that friction is actually dissipation—energy is getting more spread out among the universe but is not being destroyed. So you want to picture a big bucket of water and a thousand little glasses and we empty the bucket only by putting it into all of those glasses. And the idea is that eventually if random processes take over the moving of the water from any of these to any other of these, all of them will have the same water level. You can actually see this if you see demonstrations of the siphon effect, water will actually flow up and down a hose to equalize two water levels in two reservoirs. When energy does this, has the same average occupation in every degree of freedom of a system, we say that the system has thermalized and we can measure its absolute temperature as that energy level. Technically temperature is not uniquely defined in any other context—mostly, we find physical objects whose properties like volume or length or so vary approximately linearly with temperature in this sense, then we use them as thermometers to measure temperatures in other contexts.

Now there is an interesting result, which is that if your bucket is at the same level as the cups, in some sense your bucket never ends up empty. Like there can be a lot of cups and that water can be spread over everything and there is only a tiny film of water in the actual bucket left, but it’s not zero.

This is also a theorem, it is called the fluctuation-dissipation theorem. It says that I can't dissipate energy into some environment without feeling noise from that environment prevent me from dissipating all of my energy into it: I have to accept random fluctuations back from it. In other words, there are no one-way channels for energy.

To bring this back to your question, the basketball only comes to rest on the ground because it has so much more energy than the thermal fluctuation energy which it gets back from the ground. When it eventually settles, it turns out that it is not fully at rest but is moving imperceptibly due to these fluctuations. And those fluctuations are imperceptible because the mass of the basketball is very large, large enough that this disturbs the center of mass by a height way smaller than the size of atoms, which it turns out are way smaller than the light you can see. So like even with a microscope, visible light is too chunky to show you this on a basketball.

But repeat the calculation for how far those 25 meV of thermal energy will launch a 28-amu nitrogen molecule and you will find that the height is roughly nine kilometers [1] which is a pretty good rough estimate for the height of the Earth's atmosphere, that's about where the troposphere ends. Just to be clear, the ground doesn't kick any individual molecules that high, they collide with other air molecules way before they get anywhere near that high, but that energy and momentum does ultimately get communicated to the whole swarm of air molecules and stops the swarm collectively from falling lower than that distance on average, even though everything is one big colliding mess. The first order prediction is actually an exponential decrease in density as you go to those higher heights, and I think that 9km figure is a 1/e decay constant, but the truth gets a lot more complicated as the ultraviolet light coming into the Earth is getting preferentially scattered in the high atmosphere and contributing a second source of energy to the system.

But yeah, the air doesn't fall down to the ground because the sun is shining and keeping our planet warm, and that warmth is imperceptible in the motion of a basketball but several kilometers in terms of the height of air molecules.

[1] https://www.google.com/search?q=25+meV+%2F+%2828+amu+*+9.81+...