All stars pass through fundamentally the same life cycle: they are formed through the collapse and accretion of material in a giant molecular cloud, spend a lengthy period of time emitting massive amounts of heat and light produced by the fusion of hydrogen into helium in their cores, and then, when the hydrogen is exhausted, go through one of several types of deaths. How fast they run through this cycle, and how dramatically they die, depends upon how large they are.
Giant Molecular Clouds and Star Formation
Star formation begins in areas of the interstellar medium where free-floating dust and gas are slightly denser than average. These are known as giant molecular clouds. Often, the clouds exist among nebulae, the remnants of older stars. In this case a large number of stars may form in a relatively small area of space, referred to as a stellar nursery.
Eventually, gravity causes the material in the interstellar cloud to collapse inward. If the cloud is large enough, then the rapidly growing clump of matter in the center ultimately acquires enough mass and energy that the hydrogen gas in its core is forced together under immense pressure, and fused into helium. When this process becomes self-sustaining, a star is born.
Main Sequence
What happens next depends upon how large the cloud was, and therefore how large the new star is. For about 90% of its life (except the fairly short periods of birth and death at either end,) stars remain relatively stable, emitting radiation and light from the hydrogen reactions which continue in their core. During this period, stars can be charted according to a relationship between mass and output, known as the main sequence.
Star size can result in very significant differences in the appearance of stars. Stars such as our sun are mid-sized stars and emit yellow light. At the rate at which they fuse hydrogen, they can survive for billions of years. Much larger stars fuse hydrogen exponentially more quickly, glowing blue and surviving for only millions or tens of millions of years. Much smaller stars generate enough pressure to fuse only small amounts of hydrogen at a time, glowing a dim red. So-called red dwarfs are the longest-lived stars, with life expectancies probably measured in trillions of years. It is believed that every red dwarf ever born is still alive, unless it has been destroyed through collisions with other stars.
Star Death
As a star’s hydrogen supplies dwindle, it begins to die. How this process occurs again depends largely on the size of the star. Small red dwarfs simply run out of hydrogen calmly and wink out, gradually cooling into dead husks.
Yellow or white stars, like our sun, are more dramatic. In the last few million years of its active life, the sun will rapidly puff up as it loses the ability to keep all of its hydrogen and helium densely packed together under the force of gravity. The surface of the resulting “red giant” star will bulge outward as far as the current orbit of Earth. Eventually the star will be unable to hold this size stably, either. The outer layers will be thrown off, forming a massive, strikingly beautiful cloud known as a nebula. At the center, the former core of the sun, now roughly earth-sized, will remain as a glowing ember, known as a white dwarf. Gradually the white dwarf will cool until it no longer emits light.
Larger, blue giant stars have the most destructive deaths of all. The explosion in which they shed their outer layers is much more sudden and dramatic, known as a supernova. Their cores are dense enough that once they begin to collapse, they will not stop. Stars several times as large as the sun will collapse into neutron stars, in which the nuclear forces that keep most of an atom empty except for neutrons are overridden, and atomic nuclei are squeezed together. Even larger stars continue this process to an infinitely small point, forming exceptionally dense regions called black holes.
Sources
Helium. What Happens during the Lifespan of a Star.
Keele University. The Life of a Star.
Utah University. Life Cycle of a Star.