When the hydrogen supply in the core begins to run out, the core becomes unstable and contracts. The outer shell of the star, which is still mostly hydrogen, starts to expand. As it expands, it cools and glows red. The star has now reached the red giant phase. It is red because it is cooler than it was in the main sequence star stage and it is a giant because the outer shell has expanded outward.
All stars evolve the same way up to the red giant phase.
The amount of mass a star has determines which of the following life cycle paths it will take after the red giant phase. The last of the hydrogen gas in the outer shell is blown away to form a ring around the core. This ring is called a planetary nebula. When the last of the helium atoms in the core are fused into carbon atoms, the medium size star begins to die. Gravity causes the last of the star's matter to collapse inward and compact.