life cycle of a star
Start from a cloud of dust and gas called a nebula
Gravity pulls dust and gas together to form a protostar. As it gets denser it heats up and release particles that drive away gas and dust.
It causes and undergos nuclear fusion which gives out large amount of energy to keep the core hot
The star then enters a stable period. The force of radiation pressure from nuclear fusion is balanced with the force of gravity pulling everything inwards. This stage lasts several billion of years.
Hydrogen in the core starts to run out and the force of gravity is larger. The star’s core is compressed until it's hot and dense enough that the energy release it expand so it becomes a red giant or red supergiant.
The red giant will keep increasing in size until it becomes unstable and the gravitational forces caused it to collapse and eject it's outer layers into a hot dense solid core - a white dwarf
It will become a black dwarf as it cools down
Red supergiant start to flow brightly again as they undergo nuclear fusion until they explode into a supernova
The supernova throws dust and gas into space and leave a dense core called a neutron star. Sometime it’ll be big enough to become a black hole