Between the stars, there is a region, called the interstellar medium, which contains huge clouds of gases and solid particles. It is comprised of about 75% hydrogen, 25% helium, and traces of carbon, nitrogen and other elements. The clouds, called nebulae, are cool and relatively dense and are shaped by currents of hot, low-density gases. It is in these nebulae, that certain processes come together to form stars.
Stars form when a shock wave passes through a nebula, compressing the clouds and causing the gases and dust there to clump together. Gravity pulls the material together in the center, accelerating the atoms, increasing the density and generating heat, creating what is called a protostar. As the heat intensifies, the speed of the contraction slows as the hot gases resist gravity. The star radiates some of the heat energy out to space and the star continues to contract. The internal temperature continues to rise, the gas becomes ionized and if the star has enough mass, nuclear reactions begin to generate heat.
The solar wind blows the rest of the gas and dust away and the protostar is now a full-fledged, main sequence star. (Lattanzio)
Generally, a star is maintained in a state of Stellar Equilibrium, that is the balance between the outward pressure that is generated from the heated core of the star, and the downward pressure from the weight of the material above the core. If a star's core begins to cool, the pressure from the heat that supports the outer layers decreases, which makes the star contract because of the force of gravity. As the star contracts, the pressure on the center increases which increases the fusion reactions. The increased rate of fusion, in turn, increases the temperature, which prevents further contraction. This balance is called hydrostatic equilibrium.
Stars expand as they grow old. The star runs out of hydrogen and then helium in its nuclear reactions. The star contacts and its outer layers expand, become cool, and less luminous. The star gradually moves up and to the right on the H-R diagram. The duration of a star depends on its mass since the stars with the greatest mass consume fuel rapidly and have relatively short lives (millions of years). A low mass star conserves its energy and can live for billions of years. (Seeds)
During its life, a star burns up its hydrogen in a nuclear fusion reaction. Once the hydrogen is consumed, if it has enough mass, it can then begin to fuse together its other elements, such as helium, for fuel. It will continue on this path until finally it cannot fuse together any of the remaining elements into fuel. It is then that the star begins to die. All stars evolve, get older, move around on the H-R chart, and eventually explode or die. The particular form it takes when it dies directly depends on the star's size at its birth.
A very low mass star--a red dwarf--lower than half our sun's mass--consumes its hydrogen very slowly. It is totally convective, which means the rising hot gases from the core and the sinking cooler gases from the shell continuously stir the stellar materials. It is not hot enough to fuse helium or any of the other heavier elements, but consumes all of its hydrogen uniformly. Astronomers predict that Red Dwarf stars can live for a hundred billion years so no Red Dwarf has yet died.
More massive stars that are higher up on the main sequence have a different fate. Their greater mass means that their core and shell are not totally conductive and they have different reactions. When the hydrogen at the core of these stars fuse, the star's core fills with the byproduct, helium. When the star eventually runs out of hydrogen at its core, it is not hot enough to fuse helium, so the core begins to cools. Once it begins to cool, the outward pressure that the heat had generated lessens, and the core begins to contract. This contraction will, in turn, cause the core to heat up as the gravitational energy of the contraction converts to thermal energy. Some of the thermal energy (heat) is passed to the unprocessed hydrogen outside of the core. When this heats up enough, a hydrogen fusion reaction begins in this shell. This reaction continues to expand outward, heating the outer layers of the star and forcing them to greatly expand. The star becomes less dense as it expands and cools. A star with a medium sized mass, like the sun, will eventually become a Red Giant. A star with a huge mass will become a Supergiant.
The next step in a star's death occurs when the core compresses and heats up enough to cause helium fusion. A medium mass star (between .5 and 4 solar masses) compresses the core slowly, and when the helium is consumed, the core does not become hot enough to cause the next heaviest element, carbon, to fuse. The outer layers of the star continue to expand and are expelled by a slow stellar wind from the sun's gases. Once the relatively hot core is exposed, it generates a faster moving solar wind that overtakes and compresses this material into planetary nebula. The star loses most of its mass to the nebula, and cools and shrinks to become a white dwarf. Eventually the White Dwarfs in our universe may cool enough to become Black (cold) Dwarfs.
The most massive stars--over 4 solar masses--end their lives much more spectacularly than smaller stars. They start to die as the other stars do, by igniting the hydrogen shells and expanding to become giants or supergiants. Their core heats enough to cause helium fusion. They are massive enough to have helium fusion both in the core and in their shells, which produces, in turn, fusion of heavier (carbon, oxygen, neon, etc.) elements. These elements fuse at an ever increasing pace. The Seeds book gives the example that a 25 solar-mass star will fuse its hydrogen in 7 million years, its oxygen in 6 months, and its silicon in one day. As the core converts to iron, it can no longer produce heavier nuclei, and the core collapses in a tenth of a second. The outward force of this collapse blasts the star apart causing a massive, bright, short-lived explosion called a supernova.
If the remaining core's mass is between 1 1/2 to 3 solar-masses, it will collapse into a small, dense neutron star. If the star's remaining mass is greater than three solar-masses, the star contracts to become a black hole.
Seeds, Michael A.. Horizons: Exploring the Universe. 7th ed. Brooks/Cole, 2002
Lattanzio, Stephen, et al. Telecourse Student Guide for UNIVERSE The Infinite Frontier. 4th ed. Brooks/Cole, 2002