Final answer:
After a star like the Sun becomes unstable and loses its outer layers, it transforms into a white dwarf. The core shrinks and heats up, its luminosity decreases, and it eventually cools over billions of years. The star's intense heat and radiation during its collapse contribute to creating a glowing planetary nebula.
Step-by-step explanation:
Once the core of the Sun becomes unstable and the star's outer layers get blown away, the star will undergo a series of processes before finally collapsing into a white dwarf. After the star becomes a giant and loses mass, its core begins to collapse. This mass loss will expose the hot inner core, which will appear at the center of a planetary nebula. During this stage, the star heats up as it collapses. Even when the luminosity becomes less, it signifies the star transitioning into a white dwarf. This white dwarf, extremely dense and mostly composed of carbon and oxygen, will continue to cool slowly for billions of years as it radiates away its remaining energy.
As the nuclear energy generation in the carbon-oxygen core ceases, the core shrinks and heats up, becoming highly compressed. The star becomes very hot, with surface temperatures reaching up to 100,000 K, and emits strong stellar winds and ultraviolet radiation. These winds and radiation interact with the material ejected during the star's red giant phase, ionizing and setting them aglow, creating a planetary nebula. The core's collapse is analogous to the end of the main sequence stage, however now the star has a more complex structure with a carbon and oxygen core and a surrounding shell of helium.