So, let us first define some of our terms. When we say that the Earth will end, I think most people envision something like the Earth getting blown apart, a really violent end of the world scenario. This is not impossible, but it is far from certain. There are really two possible causes that could end the world in this manner:
- Something big hits us at very high speeds. This would have to be violent enough to blow the planet apart. If gravity were able to pull most of the pieces back together to form a new planet, it would be so different that it wouldn't really make sense to call the resulting planet Earth. Now, this is not impossible, but it is pretty unlikely. Space is huge, and mostly empty. The odds that not only would we get hit by something, but that it would be large and fast (Or, I suppose, small and extremely fast or extremely huge and slow) enough to destroy us are pretty low. After all, in the past 4.5 billion years of the Solar System existing, there have only been a few truly huge impacts. The largest we know about reconfigured Earth dramatically and contributed to the moon forming, but even that didn't destroy the Earth. Could we avoid this? Well, if it is moving fast enough, probably not. If we see it coming and have enough time, we could try to move the incoming object or Earth itself. This would require so much energy that it is basically impossible.
- A shockwave from a nearby star going Nova could be enough to blow Earth apart. I'm not sure exactly how likely this is. (We'd have to go look up how many stars are close enough that could also go nova.) But it is unlikely. If it happened, could we avoid it? Nope! There's be no way to move Earth far or fast enough to escape our dooooooom!
- Atmosphere loss. Right now, our atmosphere is protected by our electromagnetic field. Our EM field is generated by moving metal (and the electrons it contains) inside the planet. This metal is able to move because most of Earth's interior is liquid. It is liquid because the interior of the planet is really very hot. It is really very hot for two reasons: reason 1 is that when Earth Formed, it was super hot. It has been gradually cooling off ever since. About half the heat in Earth's interior is leftover heat from when the world formed. Reason 2 is that there are a bunch of radioactive materials inside our planet. As these break apart, they release heat energy. Eventually, the radioactive materials will run out, and they will stop heating the interior. Similarly, then, eventually the planet will lose its leftover heat from formation. Obviously, at some point the interior of the planet will cool enough to solidify. At that point we will lose our electromagnetic field, and the atmosphere will slowly start getting destroyed by solar wind and solar radiation. We can't predict when exactly this will happen, but: i would take a very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very LONG TIME. And when I say that, I mean that for every time I typed the word "very," you can count a billion years. Which is much longer than the universe has been around, so...not worried. That said, if we wanted to, could we somehow fix this problem? Eh. It might be possible to harvest radioactive materials from other planets and asteroids, and inject them somehow down past the crust, and wait for them to settled towards the core in the hopes that it would keep things going for a while longer, but...honestly, if we have that level of technology, we wouldn't NEED to stick around on Earth.
- The Sun expands. Right now, our sun is in the process of using the incredible force of gravity it has, thanks to its huge size and mass. This gravitational force is pulling atoms of hydrogen together, even though electromagnetic repulsion is trying to keep those atoms apart. Because there is soooo much gravity, the gravity wins, and pushes them together. This results in something called nuclear fusion. The nuclear fusion reaction then releases energy. So, the outward force of the released energy is balanced (roughly) by the inward pull from gravity. Stars, including ours, are all caught in this tug of war between gravity pulling in and fusion reactions pushing out. If too many atoms get fused and release too much energy from fusion reactions, the star will expand, and possible even go nova and explode if the outward push is enough to overcome gravity. On the other hand, if gravity is too powerful, the star can collapse on itself to form a black hole, where gravity is so strong nothing can escape. (This is all a huge oversimplification, but bear with me.) Our sun is balanced in the middle. It isn't so large that it could go nova or become a black hole, so it will have a different fate. In about 5 billion years (very very very very very far in the future,) most of the hydrogen will have been fused in the sun to form helium. Fusion will stop, and without the balancing outward pressure from those fusion reactions, the sun (now made mostly of helium) will start to shrink and collapse under the force of its gravity. Once it gets small enough, and gravity gets "concentrated" enough, there will be enough gravitational force to force the helium atoms together to form larger atoms. These new fusion reactions will release enough energy that the outward pressure will cause the outer layers of the sun to heat and expand. As the outer layers of the sun expand, they will swallow Mercury, then Venus, then Earth and then Mars. Basically, these planets will now be orbiting around INSIDE the sun. Needless to say, their atmospheres will boil away, their surfaces will get super heated, the friction with the gases in the sun will slow their orbits until they spiral deeper into the sun, and they will vaporize. The sun at this point will be a red giant, and will continue to change. The story of Eath will be over, though. Is there anything we can do? Well, in theory, we could move the Earth further out away, so that it won't get swallowed when the sun expands. This would take a lot of energy and would create some new problems of its own, but there is no logical reason it is impossible.