``What goes up must always come down". Not necessarily. Consider this plot of the potential energy
Here we have a plot of the potential energy of an object, say a baseball as a function of distance from the earth's center. Suppose we give it a kinetic energy of , Then the total energy is given by the green horizonatal line. That means that the ball can increase by turning some of its kinetic energy into potential energy. At the point where the red and green lines cross, it can go no higher. All its energy is potential and none kinetic. That's the maximum height that it can rise to.
OK but suppose I give it enough kinetic energy so that ? Now it can keep going further and further away. It'll never have to worry about running out of kinetic energy. In this way it can escape to infinity and never come back down again!
How much velocity then, do we have to give a mass that starts at the surface of the earth, so that it can escape?
This threshold occurs when . So
Well what is this?
With the radius of the earth being and , we have that . That's pretty fast!
But individual molecules at room temperature do cruise around at comparable speeds. You'll see later on when you study statistical mechanics, that the typical speed of an atom depends on its mass as . So the lighter molecules, such as hydrogen have enough velocity to escape from the earth, where as heavier ones such as nitrogen and oxygen don't. That's one of the reasons that you don't see much hydrogen or helium floating around in the air.
On other planets, the escape velocity is quite different. Jupiter has a much higher escape velocity and consequently has many more light elements in its atmosphere. Lighter planets like mars have a lot less atmosphere than the earth.