All stars form from clouds of gas and dust condensing in deep space. Only the chemical composition of this cloud, and the amount of material in the cloud that condenses into the actual star, determines what will happen to the star over its entire lifetime.
As an interstellar gas cloud starts to condense under its own gravitation, any tiny amount of spin that it has will become amplified, the way a whirling figure skater spins faster when he brings in his arms. Eventually, little whirlpools or eddies will form in this ever-more-rapidly-spinning collapsing cloud. It's these eddies that will eventually form star systems.
All that gaseous material falling in on itself in a given eddy releases an enourmous amount of heat when it starts to collide with itself. The more the whirlpool contracts, the hotter and more opaque it gets, until it gets hot enough and thick enough to glow. Such an object is called a protostar; we can see such an object from here on Earth, provided the cloud of gas and dust surrounding it is thin enough to see through.
When the protostar is nearly finished collapsing under its own weight, it will reach its maximum temperature. On the surface, it will actually be hotter than it will when it becomes a main-sequence star. But it's the temperature deep within its core that determines the protostar's fate. In most cases, the protostar's total mass will be less than about eight percent the mass of the sun, and the core temperature and pressure will not be high enough for thermonuclear reactions to begin; or, if they are, the initial belch of nuclear activity will push the outer layers of the protostar outward and rarefy the core enough to snuff the fusion reactions out. Such a "failed star" is called a brown dwarf and is probably one of the most plentiful, if hard-to-detect, objects in the galaxy.
In some cases, though, the protostar's mass (and therefore its peak core temperature) will be high enough to ignite stable thermonuclear reactions. Soon thereafter, the fusion energy released from the new stellar core reaches its surface, the initial birthing contractions finish, and the newborn star settles down onto the Main Sequence, where it will spend most of its productive lifetime.
Since main-sequence stars do not shrink appreciably over time, all of a main-sequence star's radiant energy must be produced in the core by hydrogen fusion. There are two distinct types of hydrogen-burning reactions that stellar core material can undergo. Main-sequence stars lighter than about class F0 fuse hydrogen into helium via the proton-proton chain. This is a rather straightforward nuclear reaction: (1) two protons fuse together, forming a deuterium nucleus and releasing both a neutrino and a positron (the positron eventually annihilates with an electron to produce energy); (2) then, another proton collides with the deuterium nucleus, forming a helium-3 nucleus and giving off a gamma ray photon; (3) finally, another helium-3 nucleus formed by steps 1 and 2 above collides with this helium-3 nucleus, turning it into an ordinary helium-4 nucleus and releasing two protons. The total reaction time for this entire process is on the order of one million years.
Heavier main-sequence stars take advantage of their higher core temperatures to fuse hydrogen into helium more rapidly, by a process called the CNO cycle. This is a six-step process which uses ordinary carbon-12 as a kind of nuclear catalyst. The net result is the same: four protons turn into a helium-4 nucleus and two positrons, liberating energy in the process, while all the other materials that partook in the reaction come out unchanged. (Note that, as carbon is required for this reaction, galactic halo population stars will be too heavy-element-poor to undergo it on a large scale; heavy main-sequence stars in the galactic halo use the proton-proton chain just like lighter stars do.) Unlike the slow proton-proton chain, a CNO cycle reaction is about a thousand times faster, taking only a thousand or so years to complete. This means that heavier main-sequence stars that are heavy-element-rich will shine much more brightly than lighter main-sequence stars. It also means that the heavier stars will burn out their core's supply of nuclear fuel much faster.
How hot, and large, and long-lived will a star be once it enters the main sequence? That all depends on its mass:
Avg. Mass spectral class Avg. Luminosity Avg. Diameter Main sequence lifetime 40 x Sol O5 500 000 x Sol 18 x Sol 1 million years 17 x Sol B0 20 000 x Sol 7.6 x Sol 10 million years 7 x Sol B5 800 x Sol 4.0 x Sol 100 million years 3.6 x Sol A0 80 x Sol 2.6 x Sol 500 million years 2.2 x Sol A5 20 x Sol 1.8 x Sol 1000 million years 1.8 x Sol F0 6 x Sol 1.3 x Sol 2000 million years 1.4 x Sol F5 2.5 x Sol 1.2 x Sol 4000 million years 1.1 x Sol G0 1.3 x Sol 1.04 x Sol 10 000 million years 1.0 x Sol G2 (sun) 1.0 x Sol 1.00 x Sol 12 000 million years 0.9 x Sol G5 0.8 x Sol 0.93 x Sol 15 000 million years 0.8 x Sol K0 0.4 x Sol 0.85 x Sol 20 000 million years 0.7 x Sol K5 0.2 x Sol 0.74 x Sol 30 000 million years 0.5 x Sol M0 0.03 x Sol 0.63 x Sol 75 000 million years 0.2 x Sol M5 0.008 x Sol 0.32 x Sol 200 000 million years
(Note that the luminosities and estimated main-sequence lifetime for stars hotter than spectral class F0 assumes it is heavy-element-rich enough to have sufficient carbon to run the CNO cycle; a heavy-element-poor star hotter than F0 would be considerably dimmer and last considerably longer. It should also be noted that the currently estimated age of the universe, according to big bang theory, is between 10 000 and 20 000 million years -- shorter than the lifespan of a class K or M main-sequence star. This means it should be impossible to find the remnants of any former K or M main-sequence stars anywhere in the known universe. If we ever find any, our picture of the universe -- or of stellar evolution -- will have to be revised.)
And what happens to a star when it's reached the end of its main sequence lifetime, when it's exhausted about half the available fuel in its core and can no longer sustain a hydrogen fusion reaction at the rate it once did? Well, like its properties during its main sequence lifetime, that all depends on the mass of the star.
Stars whose main sequence spectral class was anywhere from M on up through the A's will start the Beginning of the End by slowly expanding into a Red Giant (a spectral class M or K star with a luminosity class of III). When nuclear fuel is no longer plentiful in the core, it can no longer maintain its main-sequence outward pressure and begins to contract under its own weight. As it collapses, the layers above it fall inward on top of it, causing them to heat up. Soon, the layer immediately above the core will become hot enough and high-pressure enough to undergo thermonuclear reactions on its own -- and since this layer has an ample supply of hydrogen (unlike the exhausted core), it becomes a self-sustaining hydrogen-burning shell and will actually burn hydrogen into helium faster than the core did during its main-sequence lifetime. The added energy and outward pressure from this hydrogen-burning shell stops the collapse of the upper layers; in fact they begin expanding, and will keep expanding until the star becomes a Red Giant. It takes thousands of years for a star to grow from initial-collapse-at-the-end-of-the-main-sequence to the full-blown red giant stage (a 1962 study claims that it takes "only" about 20 000 years for a spctral class A main-sequence star to evolve into a class M red giant).
After a few million years, the new hydrogen-burning shell will exhaust itself also. This causes the star to contract under its own weight once again. Briefly, the super-compacted core may flash into life, fusing helium into carbon for a brief instant measured literally in seconds (the reaction rate for helium fusion is about a million million times faster than hydrogen fusion), but as helium-fusion produces much less energy than hydrogen-fusion does, and since the core is buried so deeply within the star, this helium flash will not be seen and is only predicted in theory. Finally, as this last burp of energy generated by the helium flash slowly reaches the surface, the star becomes a red giant a second time, sheds up to half its mass into interstellar space as a so-called "planetary nebula," and leaves only its core behind.
The core that it leaves behind, though, is a fascinating object. It weighs about half of what the star did during its main sequence lifetime, yet it's smaller than Uranus or Neptune. It's hotter than the star was when it was on the main sequence, and gives off blackbody radiation just like a hot star would; yet it produces no energy of its own and glows simply because it hasn't cooled off yet. Its surface gravity can measure well over 100 000 times the surface gravity of the Earth. Its average density is over a ton to the cubic centimeter; it is so incredibly dense, in fact, that all the atoms that make it up are packed together as tightly as the laws of Fermion physics will allow, making it a totally incompressible "electron degenerate" gas. This oddball super-dense stellar remnant is called a white dwarf.
Electron-degeneracy theory predicts that the uppermost mass a white dwarf can attain is about 1.4 times the mass of the sun, called the Chandrasekhar Limit. Any heavier, and the tremendous pressure on the innermost atoms would squeeze their electrons into the nuclei they orbit, turning all the protons and electrons in the star into neutrons. So far, no white dwarfs of more than 1.4 solar masses have been found, so the theory seems to be on firm ground.
The low surface area and high specific heat of a white dwarf means that such an object would take a long time to cool off -- longer, even, than the currently estimated age of the universe. If the universe were a few hundred thousand million years older, we would expect it to be populated by white dwarfs that have cooled off below the point where they glow; these academic objects are referred to as black dwarfs.
A class B main-sequence star will leave the main sequence much as lighter stars do, collapsing a little, forming a hydrogen-burning shell, turning into a Red Giant (or a Cepheid variable like Polaris), shrinking again as its hydrogen-burning shell exhausts itself, then shining more brightly as its core goes through a helium-burning phase. The difference now, though, is that burning helium into carbon in the star's core is no longer the end of the road. As this fuel supply runs out, the star's collapse reignites the depleted hydrogen-burning shell and turns it into a helium-burning shell. This renewed energy then creates a new hydrogen burning shell in a layer above the old one, so that as we move inward from the star's surface, we get a hydrogen burning shell, then a helium burning shell, and finally the core underneath. The core will likewise undergo renewed thermonuclear vigor, fusing its old carbon together with more helium to form oxygen.
When this stage completes, the core can begin fusing oxygen into neon, the old helium-burning shell can become a carbon-burning shell, the formerly outermost hydrogen-burning shell becomes the new helium-burning shell, and yet another thin hydrogen-burning shell emerges outside of that. And then, neon can fuse into magnesium, then magnesium can fuse into silicon, and so on down the periodic chart until, finally, chromium gets fused into iron. Each of these fusion stages (helium-to-carbon, carbon-to-oxygen, . . . , chromium-to-iron) produces less energy than the preceding stage does, and thus exhausts its own fuel supply ever more rapidly. During these late stages of its evolution, the star can bloat up to hundreds of times the diameter of the sun, becoming a red supergiant like Betelgeuse.
Finally, though, when the star gets around to wanting to fuse iron into something heavier, it runs into a problem. Iron is at the "bottom of the well" when it comes to nuclear reactions. Fusing it into something heavier, or for that matter breaking it apart into something lighter, always consumes more energy than it produces. So when the core starts to "burn" iron, it ends up getting cooler, not hotter. All the outward pressure that its nuclear reactions have been generating suddenly vanishes. The star's core collapses in the blink of an eye. And, since the core takes up such a large fraction of the star's total mass, it's heavier than the maximum 1.4 solar masses that can support a white dwarf. Its protons and electrons get squeezed together until it is a solid ball of neutrons, no bigger across than Los Angeles and with the density of an atomic nucleus (around a thousand million tons to the cubic centimeter). It is now a neutron star and is said to be "neutron-degenerate." The surface gravity of such a beast is on the order of a million million G's.
In collapsing in on itself to such dense proportions, all of the core's
gravitational potential energy has to be released in the form of heat, just like
the collapsing cloud that originally formed the star heated up as it
contracted. This time, though, the amount of energy released is much greater
and happens over the span of a few seconds. All the outer layers of the star,
even those that never became nuclear fusion shells, will become superheated plasmas
hot enough to fuse their constituent ions into not only iron, but copper,
strontium, silver, gold, lead -- even uranium. (2015 Update: Recent
computer models show that this explosion won't actually get hot enough to create
appreciable quantities of elements heavier than iron. These heavy elements are more
likely created in the mergers of binary neutron stars, which are even rarer and
more energetic.)
These super-hot, super-bright outer layers race off into interstellar space at
nearly the speed of light, carrying their newly-formed heavy elements with them and
creating one of the most spectacular and rare sights in the heavens: a type II
supernova.
(Incidentally, it's believed that supernovae are the only phenomena that can send heavy elements into the interstellar medium. Thus, the heavy element enrichment that our solar system enjoys is thought to be the product of earlier supernovas that infused their products into the cloud that our own sun (and its planets) condensed out of.)
With the aid of telescopes, the expanding cloud from a type II supernova can be seen for many centuries hence as a nebula (such as the crab nebula). The neutron star left at the cloud's center is too small to be seen with current instruments, but it can be detected by its radio emissions if one of its magnetic poles happens to sweep past the Earth as the star rotates. (Its collapse to such a compact object means it will be spinning very rapidly; its magnetic pole may sweep past the Earth hundreds of times a second. It would thus appear to a radio telescope to be a very rapidly, regularly pulsating radio source called a pulsar.)
The rare class O main-sequence stars start the end of their lives as the middleweight stars do, bloating, forming energy-producing shells around the core, and fusing heavier and heavier elements together until the core becomes iron. And, once again, when the core attempts to fuse iron into something heavier, it loses its energy support and collapses, crossing the Chandrasekhar Limit and squeezing itself into a ball of neutrons.
There is, however, a theoretical limit on how heavy even a neutron star can become. Past about three solar masses, even neutron degeneracy can't support the core's weight. In fact, no force known can support its weight. The core continues to collapse until it is an infinitely small, infinitely dense point called a singularity. Its gravity will be so strong that neither the material from the original core's outer layers, nor the energy from the core's collapse, nor even a beam of light directed straight outward can escape it. Nothing that comes within the Schwarzchild Radius (3 kilometers times the mass of the singularity in solar masses) can escape it. As far as the outer layers of the star are concerned, the core has merely fizzled out, removing its energy support and letting them fall; these outer layers too will fall within the singularity's gravitational grip never to be seen again. The whole star swallows itself, leaving only its gravity behind; it's now called a black hole.
In a binary star system, one star will usually be more massive than the other, meaning that the heavier star of the pair may end its main-sequence lifetime millions or thousands of millions of years before its lighter companion does. Many white dwarfs, for instance, have been detected because of oddities in the movement or appearance of their main-sequence companion -- Sirius B being the most famous example, discovered by accident over a century ago when a new telescope lens resolved Sirius's companion during a test. Sometimes, due to orbital decay or the fact that the longer-lived companion star has reached the end of its lifetime and is turning into a red giant, a white dwarf , neutron star, or black hole can come so close to its binary host-star that its strong gravity begins drawing (or "accreting") material off its host. Such a system is called a mass-exchange binary.
This sucked-up gas swirls around the white dwarf or neutron star, forming an accretion disk as it siprals in toward its new owner's surface. In the case of a neutron star or black hole, the accretion disk will be the only feature of the companion star visible from the Earth. Material accreted "onto" a black hole essentially goes down the event-horizon drain and is gone forever. Material accreted onto a neutron star or white dwarf, however, will accumulate on that star's surface, forming thicker and thicker layers of super-compressed hydrogen. If the infalling material is moving fast enough, this accreted hydrogen can gain sufficient heat and pressure for thermonuclear reactions to occur.
Depending on how fast the incoming material is moving, several things can happen to a white dwarf. Very rapidly infalling material will ignite all at once, causing the white dwarf to shine several times more brightly than its companion for a few days, then taper off back down to its original brightness. Years or centuries later, the process may repeat itself. This phenomenon is called a nova (the Latin word for "new") because, to the unaided eye, it looks like a new star has appeared in the sky where before there was none. If the accreted material is trickling in more slowly, it will only ignite in small spurts, turning the white dwarf into a cataclysmic variable. If the accreted material accumulates very slowly, the white dwarf can heat up as a whole, until the entire star blows itself apart in one massive thermonuclear fireball called a type I supernova.
A neutron star whose accreted layers ignite will burn all its available newfound hydrogen into helium in a matter of seconds. This is only visible as an intense burst of X-rays lasting for, at most, a minute or two. The process repeats itself sporadically every few hours as new material is accreted. Not surprisingly, such phenomena are called X-ray bursters.