Images of planetary nebula offer us glimpse of the fate of our sun. For one day our sun will suffer a similar fate as the dying star in this video. In an estimated 4-5 billion years, the sun will enter into the final stages of its life.
The sun formed around 4-5 billion years ago and is currently half way through its life. The sun formed from a swirling cloud of hydrogen gas that collapsed under its own gravity. The increasing temperatures ignited nuclear fusion within the core of the forming star and the sun was born. Hydrogen within the core of the sun continues to be fused into helium, powering the star.
The sun is made mostly of hydrogen, yet helium is accumulating in the core. The sun only contains a finite amount of usable hydrogen, so eventually it will run out. Since it was born, the sun has been fighting a continues battle between two forces: gravity and the nuclear forces within the core. The gravity of the sun tries to crush it, while the nuclear forces in the core try to expand the sun. Both of these forces create a kind of equilibrium, yet it won't last forever. When the sun begins to run out of usable hydrogen, the nuclear forces weaken and the sun will begin to collapse. However, the compression of the sun will cause an increase in temperature which allows helium to be used as fuel. Helium fuses to form heavier elements, like carbon, oxygen, nitrogen, and other elements.
The fusion of helium and other heavier elements will cause the sun to expand and cool. The sun will become many times its current size and it will cool and become red in colour. The sun will become a red giant. Through many periods of expansion and contraction, layers of heavier elements form within the sun. As the sun expands larger in size, its mass decreases and it begins to lose more material to space. The outer layers of the sun will be lost to space to form a shell of material around the sun called a planetary nebula. Meanwhile, the core of the sun will gravitationally collapse to form a white dwarf.
Video credits: @bosplanet