All stars evolve the same way up to the red giant phase. The amount of mass a star has determines which of the following life cycle paths it will take after the red giant phase. The last of the hydrogen gas in the outer shell is blown away to form a ring around the core. This ring is called a planetary nebula. When the last of the helium atoms in the core are fused into carbon atoms, the medium size star begins to die.
Gravity causes the last of the star's matter to collapse inward and compact.
This is the white dwarf stage. At this stage, the star's matter is extremely dense. White dwarfs shine with a white hot light. Once all of their energy is gone, they no longer emit light. The star has now reached the black dwarf phase in which it will forever remain.