I've got some good news and some bad news.
The good news is that when the Sun starts to die and swells into a red giant we'll have great seats!
The bad news is that those seats will be inside the Sun.
If it helps, you can postpone your panic for about 7 billion years. That's when the show really starts.
I wrote about this a bit a few days ago, about what happens a star like the Sun starts to die. But to recap:
The Sun is currently a very stable star, with hydrogen in the core merrily undergoing nuclear fusion, transmogrifying itself into helium and energy. The energy leaking out of the core and into the upper layers is what keeps the Sun inflated, like a hot air balloon supporting itself. It's been doing this for over four billion years, and that's where we are now.
But, over time, helium builds up in the core. It takes a lot more pressure and higher temperature to fuse helium, so for now the helium is inert. It just sits there, slowly heating up. In roughly 6 billion years the Sun will run out of hydrogen in the core, but the core will shrink and heat up so much that hydrogen will fuse in a thin shell just outside the core. That dumps more helium into the core, contracting it and heating it further. Eventually, after some hundreds of millions of years further, conditions get so dire that helium itself fuses. The process above repeats, except this time helium fuses into carbon and oxygen, which build up in the core, generating vast amounts of energy*.
All this is happening deep in the Sun's core. The outer layers react to this, slowly, but react they do. When hydrogen shell fusion starts the outer layers will swell up enormously, turning the Sun into a red giant. It'll shrink somewhat when helium fusion begins, then swell up again when the carbon and oxygen build up.
This is where things get fun, if lighting a blowtorch to the inner planets is your idea of fun.
When the Sun goes red giant, it'll get big enough to engulf Mercury and Venus for sure. They will literally exist for some time inside the Sun, orbits decaying as they plow through the hot plasma, falling farther in and eventually vaporizing entirely.
The Earth's fate isn't so clear. As the Sun expands, it starts to blow a wind of subatomic particles, like the solar wind now but much denser. The Sun will lose enough mass that its gravity will weaken, and that means the planets' orbits will expand. The problem is that the Earth is pretty much on the line dividing getting swallowed by the red giant Sun and moving away enough to escape that fate. It depends on the detailed physics, like how much mass loss the Sun will undergo, and I've seen the arguments in journals go back and forth for a while now.
Well, I just so happened to be talking to my old Master's degree advisor, Noam Soker, about dying stars recently, and he casually mentioned that he's done the math! In a paper published in 2018 he looked into how much mass the Sun will lose. If a dying star engulfs a big planet (like Jupiter), then it will lose a lot of mass as the planet orbiting inside it spins it up like a fork whipping up a bowl of eggs. The star spins more rapidly, making it easier to throw off matter. Many stars do indeed have such big planets on tight orbits.
But if the star lacks such a close-in planet, it won't lose nearly as much mass. That means that as these stars expand, they'll still be holding on to their inner planets.
Yeah, that's us. Mercury and Venus won't do much inside the Sun but fizzle and die, so the Sun's wind won't be very strong, so it'll keep more mass, which means its gravity won't drop as much as previously thought.
Which means, in turn, the Earth may very well still be close in as the Sun expands to a red giant. And, well, that sucks for us. The Sun will eat our planet.
Not that the alternative was great, mind you. Even if the Earth managed to stay outside the Sun, the Sun will expand so much it will fill Earth's sky. It will be so hot that the solid rock of our planet will boil, so being inside or outside the Sun is kindof a technicality at that point. Either way, yikes. Cooked planet.
To remind you, we're talking about events that play out roughly 7–8 billion years from now. If you're worried about your 401k or the upcoming election, this isn't something that should weigh too heavily on you. And hey, if it helps, the Sun is slowly heating up now, and in a few hundred million years the Earth will be uninhabitable anyway!
I rather hope that whatever humanity looks like in that far-flung future, we're smart enough to have left for cooler climes out there in the galaxy. Who knows, maybe we'll even tow the Earth to a safe distance (which, to be honest, is difficult, as the Sun will fluctuate a lot during those red giant phases so the Earth will need to be moved around quite a bit).
The way I see things, this is of scientific interest, and even human interest, but there are far more pressing matters calling for our attention now. It's always interesting to wonder what the far future holds, and there may be important things to learn from it, but one lesson I take is that we need to appreciate the time we have now, and make it as best we can. Nothing lasts forever. Not even planets, or stars.
*The actual physics and process going on is more detailed than this, and way cooler, but you don't need to know it for what I'm discussing here. But if you want to know more, well, I know a guy.