When a star becomes a white or red dwarf, its size is no greater than that of the Earth and it shines a little just before dying. It then dies out after several billion years and becomes dark and invisible in the sky. Its surface becomes solid then icy.
If a star is much heavier than the Sun, it literally burns its twenty years, lives at most a few hundred million years and dies much earlier and in a very violent death.
Stars 20 or 50 times more massive than the Sun become supergiants red or blue in the space of a few million years and lead a very hectic life. Their core is so massive and dense that it reaches a temperature that exceeds 3 billion degrees! So unstable these stars eventually explode: it is the phenomenon of supernova. It gives birth to a huge gas bubble that expands in space. A new planetary nebula is born.
Meanwhile his core implodes in shock and contracts very quickly. The residue of the star collapses to a few kilometers in diameter; according to its mass it becomes either a small white dwarf star, a neutron star or a pulsar. The last two stars emit repetitive sounds that can be heard with a radio telescope to the point that the first time we heard them astronomers it was believed that these were messages issued by extraterrestrials!
In all three cases, the star continues to shine for a few hundred million years and then cools and disappears, turning into a small dark and cold star on the solid surface. If the core is very massive the star becomes a black hole.