Here's a breakdown:
1. Red Giant Phase: A star like our Sun, after exhausting its hydrogen fuel, expands into a red giant.
2. Planetary Nebula Formation: The outer layers of the red giant are expelled, forming a glowing cloud of gas called a planetary nebula. This is a misleading name - it has nothing to do with planets!
3. White Dwarf: The core of the red giant, now exposed, is a very hot and dense object called a white dwarf. It is primarily composed of carbon and oxygen.
White dwarfs are the remnants of stars like our Sun. They no longer undergo nuclear fusion and slowly cool down over billions of years. They eventually become black dwarfs, cold and faint objects.