Look closely at the night sky and some stars are bluish white while others are red. This difference of color is a difference in the temperature of the surface.
A heated body emits light set by its temperature. The higher the temperature, the shorter the wavelength at which the emission is strongest. Short wavelengths are the blue side, so the hotter the star, the more bluish white it looks.
The surface of a bluish white star is about K, the sun is K, and a red star is about K. K is the kelvin, a scale that takes °C as .
What matters here is that color can be measured without knowing the distance. However far away the star is, the color of the light that arrives does not change. Temperature is the first thing that can be known about a star.
A star that looks bright in the sky is not necessarily bright in itself. A faint star close by also looks bright. To compare the stars themselves, they have to be measured by the amount actually emitted rather than the amount that arrives.
The light a star emits spreads out in every direction. Double the distance and the same light spreads over times the area, so the amount arriving per unit area falls to . It is inversely proportional to the square of the distance.
The amount actually emitted is called the luminosity and is written . Given the apparent brightness and the distance, follows. In astronomy it is put on a scale that takes the luminosity of the sun as .
The vertical axis of the HR diagram is this luminosity. The values span about orders, so the scale is taken as the power of 10.
Take the surface temperature along the horizontal axis and the luminosity along the vertical, and plot the measured stars one by one. This diagram is called the HR diagram, after Hertzsprung and Russell.
The horizontal axis is taken so that the temperature falls toward the right. The left is the hot, blue side and the right the cool, red side. It looks backwards, but this is the settled direction in astronomy.
Plot them and the points do not scatter at random. Most of the stars gather into a single band running from the upper left to the lower right. This band is called the main sequence.
While on the main sequence, a star is turning hydrogen into helium at its center. This is the state a star stays in longest, which is why so many stars are seen here. The sun is one of them.
There are stars off the band as well. In the upper right are stars that are bright despite a low temperature. In the lower left are stars that are faint despite a high temperature.
The light a star emits is the amount per square meter of its surface times the area of that surface. It can be written , where is the radius and is a fixed constant.
Bright despite a low temperature means that what lacks is made up by , which is to say the radius is large. These are the giants. The stars in the lower left, faint despite a high temperature, have a very small radius. These are the white dwarfs.
Stars of the same radius fall on one slanted line in this diagram. The three lines drawn here are those, at times, time and times the radius of the sun. The giants sit well above the line for time, and the white dwarfs sit around the line for times. Which way a star is off the band is the difference in its radius.
A star is born when the gas and dust lying between the stars gathers together. How much gathers, which is to say the mass, decides where on the main sequence the star arrives. The heavier it is, the further to the upper left; the lighter, the further to the lower right.
When the hydrogen at the center runs out, the star leaves the main sequence. The outer part swells, the surface temperature falls, and the area grows so the star becomes brighter. On the diagram it moves to the upper right. This is a red giant.
For a mass about that of the sun, the swollen outer part is thrown off and only the center remains. What is left is small and hot, so it drops to the lower left of the diagram and becomes a white dwarf. The gas thrown off returns to the space between the stars.
A heavy star does not take this path. It ends far more violently, as a supernova. The time taken differs as well, and the heavier the star, the sooner it is over. Once the mass is settled, the path the star will take is very nearly settled with it.