Basically, a star is big ball of gas, mostly hydrogen.
The star is so massive that gravity forces the material to collapse in on itself.
The compression/temperature at the core becomes so great that hydrogen ions fuse forming helium and releasing a tremendous burst of light/energy which, in turn, pushes the gas back out preventing further collapse. When a medium sized star starts to run out of hydrogen to fuse, it begins to collapse again until helium fusion begins, causing the star to expand and, expel portions of its outer layers. After several iterations of this, helium fusion ceases and there's nothing left but the very hot inner core surrounded by expelled gas.
Since fusion has stopped, the central star can be though of as dead/inert, doing nothing but cooling down until the end of time. While one might think of them as "dead", the massive compression makes white dwarfs among the hottest "stars" at 50,000-100,000 K; the cooling takes billions of years. This white dwarf is very small and therefore faint, but gives off much higher energy photons than most stars. For example, ionized helium (very high energy transition) is rarely seen except in planetary nebulae around white dwarfs.
Here are older images of two of the most famous planetary nebulae, shot with narrow band filters showing high energy blue helium in the center, teal/green oxygen further out, with low energy red nitrogen in the outer ring, or mid-substance pillars (also note the small bluish central star/white dwarf):
M 57, the ring nebula:
M 27, the dumbbell nebula:
In the late expansion phase, the star grows to 100 times it's original size and cools, becoming a red giant. Since the red giant is emitting light from a much larger surface, it's much brighter than the original star (example Betelgeuse, Orion's shoulder). Conversely, a tiny white dwarf is very faint, but hot, emitting much higher energy photons which can ionize helium while the brighter red giant cannot--the photoelectric effect on a cosmic scale.
Fusion of helium etc can continue on up to oxygen and carbon. When the planetary nebula sheds its outer layers, it sends carbon oxygen etc into outer space, allowing future solar systems to form with higher oxygen and carbon content--cosmic recycling.
Rather than collapsing into a white dwarf, a larger star explodes forming a supernova.
It is thought that some of the coolest white dwarfs crystallize, and since they are primarily made of carbon/oxygen...yup, you got it, planet-sized diamonds. Which of course is great material for comic-sci-fi, pink floyd songs, etc.
M 57 8" LX200R, SX AO, IDAS LPR, SX H9, H9c
astrodon 5nm Ha, 5nm OIII, 3nm NII, CS 10nm HeII, OO 5nm HeII filter, IDAS LPR
RGB 29x20 min
Ha 34x20 min, NII 23x20 min, OIII 22x20 min, HeII 31x20 min
M27 NII 34x20 min, OIII 12x20 min, HeII 30x20 min8" LX200R, SX AO, SX H9
astrodon 3nm OIII, 3nm NII, CS 10nm HeII,
Los Alamitos, CA Bortle white skies