What is the life cycle of a star?
The life cycle of a star depends on it's mass. Although all stars go through a main sequence, what happens after is very different for small stars and large stars.
All stars are "born" from a cloud of gas and dust called a nebula. They start as a protostar, a dense pocket of gas that collapses inward due to its own gravity, getting hotter as it squeezes inward. It becomes a star when the pressure and temperature reach a point where the hydrogen in the core of the protostar begins to fuse to helium, releasing tremendous energy.
A star fusing hydrogen is said to be in its main sequence.
Very tiny protostars that never have enough mass and gravity to start fusion are called brown dwarfs.
Stars with just enough mass to trigger fusion produce a minimal amount of energy, and are called red dwarfs. They take a very long time to use up their hydrogen fuel (tens or hundreds of billions of years), and when they do, they just die out and cool down.
Slightly larger stars, like our sun, will remain in the main sequence for around ten billion years. As the hydrogen runs out (converted to helium) the star sputters, and undergoes another round of collapse, increasing the density in the core and triggering the fusion of helium into heavier elements. The extra energy from helium fusion causes the outer layers to puff out, creating a red giant. Eventually, the outer layers drift away, leaving only the tiny core. This is called a white dwarf.
Larger stars use up their hydrogen quickly (tens or hundreds of millions of years) then undergo multiple rounds of collapse & re-ignition with heavier and heavier elements. These form supergiant stars. Their life ends violently when they begin producing iron in the core, because fusing iron absorbs energy rather than releasing it, so it rapidly shuts down the energy output of the core, causing the rest of the star to collapse inward, and then explode as a supernova.
The collapsed core may become a neutron star (an ultra-dense ball of atomic nuclei) or a black hole.