The life cycles of stars depend on their mass. Stars similar to our Sun will have a different fate than massive and supermassive stars. All the stars remain in main sequence for a long time, similar to the current state of our Sun. The stars in main sequence fuse hydrogen to helium and thus obtain energy. Over time, the hydrogen in the core finishes up, while the hydrogen-to-helium fusion continues in the outer envelope. This causes the inner core to collapse and outer envelope to expand. At this stage, the star becomes a red giant. The fate of a star after the red giant phase is a function of its mass.
Average stars (like our Sun) will have smaller mass and their cores will stabilize and helium will start fusing into carbon, thereby providing energy to the star. The outer envelope will continue its expansion and the star will become a planetary nebula. Finally all the helium in the core will be finished and only carbon would be left. When that happens the outer envelope will be detached and lost, leaving behind a small core, which will ultimately result in a white dwarf.
i.e. Average star-> red giant -> planetary nebula -> white dwarf
In case of massive stars (mass ~ 10 solar masses or more), the fusion in the core continues, from helium to carbon, then to oxygen, neon, silicon, sulfur and ultimately to iron. The core will continue its collapse until a supernova explosion takes place, in which most of the star's mass will be lost and the star will release enormous amounts of energy. If the mass of the original star was around 10 times the mass of our Sun, the core will become a neutron star. If the star was even heavier, it will end up as a black hole, a region of such high gravity that not even light can pass.
i.e. massive star -> red giant -> supernova -> neutron star or black hole
Hope this helps.