The Life of a Star (Not my autobiography)
The life of a star is a long and interesting one, I read about this process in the one and only book The Cosmic Cocktail by Katherine Freeze.
The main sequence of a star (which are sun is now in) is when the fusion of four hydrogen atoms to a helium atom releases heat and energy. This type of fusion is hard to even imitate here on earth because we don't have enough energy to make it happen. As this fusion takes place more inert helium is built up until finally all the hydrogen is gone and we are left with a helium filled star.
Without any fusion taking place the pressure in the star is not enough from keeping it from collapsing. When it does collapse from gravitational effects, the helium will start to be burned and fused together to make carbon! This is when the red giant stage starts and the sun increases in size by massive proportions. At this time our earth, and other close planets, will be consumed in this expanding sun and burn to a crisp . But no worries, that's in about 5 billion years!
Once all the helium fuel is gone to, literally NOTHING is left to burn or fuse, which means gravity can work its magic and collapse the star like it has been trying to for 10 billion years. When it does contract it becomes a white dwarf, the Pauli exclusion principle explains the pressure inside the star, which basically says that two electrons cannot be in the same place at the same time which creates a pressure inside the star that sustains it. The density at this point is extremely great because you would have a blue dwarf with about half the mass of our sun but the size of our earth.
This is where the paths diverge though, for heavier stars like ones 20 times bigger than our sun, the star will collapse into a black hole since its density is so great and creates so much gravitational pull. For Stars a little bigger than our, say 3 times, they collapse to neutron stars, where the same principle used for white dwarfs applies except with neutrons now! Two neutrons cannot be in the same place so the star is stabilized and continues to shine.
These 3 outcomes, white dwarf, neutron star and black hole are pretty amazing to think about and have massive effects on the structure of our whole universe.