A star's size, color, brightness, and lifespan are the consequence of the total amount of its mass. Stars with only small amounts of material (a few tenths the mass of our Sun) become cool "red dwarfs" that live for many billions of years. Stars with the mass of our Sun last for about 10 billion years. Giant stars, with a few tens of the mass of our Sun, consume their fuel furiously and burn, white-hot, for only a few million years.
Over its entire lifetime, a star's hydrogen is being fused into helium. Late in the star's life, its helium mass becomes great enough to reach the necessary pressure and temperature, and the helium begins to fuse into still heavier elements. Shells of fusion, each requiring higher and higher pressures and temperatures, form from the ashes of the previous reaction and create new elements in the process known as nucleosynthesis. The additional heat produced in the core causes the star to swell.