Through the process of nuclear fusion, and its conversion of Hydrogen to Helium, the star is able to create fuel for itself.
This is an average star, it's temperature can range from 2626.667 to 6726.6667 degrees Celsius.
Usually you would think that blue = cold, and red = hot. However, with stars, red giants are way cooler than the extremely hot blue stars.
Red giants will have periods of instability, where material from its outer layers will disconnect in clumps.
This is a red giant. The star is now depleted of all it's hydrogen, and is starting to use hydrogen further out from it's core. This causes the star to cool down and expand. The star also starts converting helium into heavier elements like oxygen, carbon and nitrogen.
The star will be in this stage until there is no more gas to release, and all that's left is a small white star known as a "white dwarf".
The gas surrounding this star is called a "planetary nebula". This has nothing to do with planets, but rather is the gas that was released during the red giant's periods of instability.
The star no longer has any fuel to release, and now remains as a "hot dense sphere of electron degenerate" matter. The star will eventually lose all of it's energy, and will forever remain as a black dwarf.
Although it may appear to be very small in the night sky, it actually has about the same mass as our sun.