
In the early 20th century, astronomers (Hertzsprung, Russell) constructed the color-magnitude diagram and noticed that stars of different types lie in certain regions. By the 1950s, physicists explained these sequences as stages of stellar life.
Like in a campfire: as long as there is wood (hydrogen), the flame is steady. When hydrogen in the core runs out, the core contracts and heats up, and the envelope expands — the star bloats. Then mass decides the fate: light stars quietly fade away, heavy ones end in a grand explosion.