Stars of different mass evolve at different rates. Whether they have high mass and evolve quickly or low mass and evolve slowly, all main sequence stars must eventually run out of hydrogen. When this happens, their properties will change in such a way that they leave the main sequence in the H-R diagram.
Hertzsprung-Russell diagram. Click here for original source URL
When a main sequence star has converted all its core hydrogen to helium, the core will collapse because it is no longer sustained by pressure from fusion reactions. As the core collapses, its temperature (and the temperature at slightly larger radii) rises. Just outside the core, then, we find temperatures finally hot enough to fuse unburned hydrogen into helium — a stage called hydrogen shell burning. The collapsing core releases energy from gravitational contraction, creating pressure and driving the hydrogen-burning shell to layers further and further out. The increased temperatures cause a great expansion of the outer layers, making the star evolve rapidly toward a giant size. The outermost atmosphere becomes huge, thin, and cool, even though the inner core is smaller, hotter, and denser than ever. From the outside, the outer atmospheric layers are seen to glow with a dull red color, and the star is perceived as an enormous red star: a red giant.
The size of Betelgeuse compared to our solar system. Click here for original source URL.
In an evolved star, the core’s evolution begins to evolve independently of the outer atmosphere. The characteristics of the star as perceived by an astronomer on Earth are those of the outer atmosphere. These characteristics determine the star's position on the H-R diagram. When you go outside at night and look at Betelgeuse or Antares, you are seeing the cool, red, outer atmosphere of a star. Hidden inside is a very hot, dense core. Thus although we may say "the star" is cooling and getting redder, it is really its atmosphere that is cooling. All this time, the core is shrinking and growing hotter. Helium "ash" is also being added to the core from the hydrogen burning shell above it.
The largest giants are truly immense — approaching 1000 times the size of the Sun. If the Sun were replaced by one of these stars, its thin, outer atmosphere would reach nearly to the orbit of Jupiter! Because the outer layers of the star expand, they are farther away from the bulk of the star’s mass. This means that they feel a smaller gravitational pull from the star and can escape more easily. The star therefore develops a "wind" and starts to lose mass from its outer layers. This is one of the ways stellar material returns to interstellar space.
As charted on the H-R diagram, stars from all points along the main sequence display a funneling effect: as they move off the main sequence, their evolutionary tracks funnel into the red giant region. They resemble patients from all walks of life crowding into the same hospital because they are victims of the same condition — hydrogen exhaustion.
The next stage of evolution depends on a star's mass. In low mass stars, a strange thing happens — as the core contracts and heats up, it reaches a density where the electrons become degenerate. There is a physical limit on how closely electrons can be squeezed together, for a given temperature. It's caused by a quanum principle that no two particles can have exactly the same set of properties; the effect is to act as a kind of pressure. For these stars (with masses less than about 2 solar masses) the core stops contracting and gravity is balanced by degeneracy pressure from the electrons, instead of by heat pressure form nuclear reactions. In more massive stars, there is enough gravitational pull to overcome the degeneracy pressure and the core contracts further.
Overview of the triple-alpha process. Click here for original source URL.
In both cases, the cores of these evolved stars contract until they reach temperatures near 200 million Kelvin. This is hot enough to begin to fuse helium nuclei in the central regions of most stars, primarily by the triple-alpha process (named after the alpha particle, another name for the helium-4 nucleus):
4He + 4He → 8Be + photon
8Be + 4He → 12C + photon
In this process, three helium-4 nuclei combine to produce a carbon-12 nucleus. Because beryllium-8 is unstable, some beryllium atoms break up before completing the process, but this merely reduces the efficiency of the process. It does result in a deficit of beryllium and its neighboring elements in the periodic table, accounting for the steep valley that follows hydrogen and helium in the graph of the cosmic abundance of elements. Notice that we are now fusing helium to make an even heavier element, carbon. Carbon is the basis of life on Earth, so this is a momentous step.
The triple-alpha process produces fantastic energy. In most cases of nuclear burning in stellar cores, there is a built-in regulation that controls how much the core can heat up. If the core contracts slightly, the temperature rises and the rate of nuclear burning increases. This results in higher pressure to resist gravity and the core expands, the temperature drops and reactions slow down. In low-mass stars, something much more violent happens when helium burning starts in the core. The fact that these cores are degenerate at this point makes all the difference. Because pressure in a degenerate gas does not depend on temperature, when the triple-alpha process starts and the temperature begins to rise, there is no accompanying rise in pressure. So, the core does not expand, and the temperature does not drop. Instead, the rate of helium burning keeps increasing in a runaway event called the helium flash. Since the energy from the flash diffuses through the star slowly, the heating effects seen at the surface may last thousands of years. The flash takes place as the star puffs up to become a giant. In a solar-type star, it occurs about 300 million years after evolution off the main sequence. In higher mass stars, the core never becomes degenerate, and helium burning begins more quietly. In either case, low or high mass, the onset of helium burning is a new stage of evolution and the star moves to a different place on the H-R diagram.