Once the hydrogen stores of a moderately-sized star like our sun are used up, it no longer functions. Its mass contracts, the outer layers get heated and the star expands into a red giant. The increased heat causes the helium in the core to fuse into carbon. When the helium store is depleted, the core cools down and releases some of its material into space, causing the remaining star to form a planetary nebula. Finally the core will be transformed into a white dwarf, followed by a black dwarf, and then it disappears.
If a star's mass is substantial, instead of cooling down once the helium store is depleted, its core will continue to fuse into iron. At that point the star collapses from its weight, heating up the iron so much that its protons and electrons merge into neutrons, producing a contracted neutron core. The extreme heat causes the core to explode and release energy and matter into space, producing a supernova. The dead star's remains become a neutron star and other released matter and gases are absorbed by other bodies in space.
How do spiral galaxies form?
Answered by Science Channel
How do we measure the distances to stars?
Answered by Dr. Gerard van Belle
What is the habitable zone of a star?
Answered by Dr. Evgenya Shkolnik and Dr. Jeff Hall