Stars form from dense clouds of relatively cool, tenuous gas located primarily in the spiral arms of galaxies. These clouds, containing about 75% hydrogen, collapse and the contraction causes the internal temperature to rise. The time required for the gas cloud to condense into a proto-star is of the order of ten million years. Once the temperature reaches about 10 million K (~18 million °F), nuclear fusion reactions start that convert hydrogen into helium. As hydrogen nuclei are protons, which carry a positive charge, they repel each other. The high temperature is necessary to give the protons enough energy that they move fast enough that when they collide, their "speed" overcomes the repulsion between them. In stars up to about 1.3 solar mass, the proton-proton chain reaction dominates. In stars heavier than 1.3 solar masses, the CNO cycle dominates. The Sun, for example, converts about 98.3% of its hydrogen using the proton-proton reaction, the remaining 1.7% via the CNO cycle. The energy this produces counteracts the force of gravity so the star stops contracting. While stars are converting hydrogen into helium in their core they are referred to as main sequence stars. Our sun is a typical example. Brightness (luminosity) and color are functions of the mass of the star. Cooler stars are redder, while hotter stars are bluer. The sun is yellow and toward the middle of the range.
The more massive a star, the faster it burns up its hydrogen, so the shorter its life. The sun is about half way through a main sequence life of around 10 billion (109) years. Really massive stars can use up their Hydrogen in mere millions rather than billions of years. VY Canis Majoris is perhaps 20 times the size of the Sun, and only a few million years old, but is nearing the end of its days. On the other hand, small stars last much longer. A red dwarf with, perhaps, 10% of the Sun's mass, may spend over a trillion years on the main sequence.
The Main Sequence
Astronomy & Cosmology -
Stars - Life & Death of Stars
The Hertzsprung-Russell diagram. A plot of luminosity (absolute magnitude) against the color of stars ranging from the high-temperature blue-white stars on the left side of the diagram to the low temperature red stars on the right side. Note that the temperatures quoted are surface temperatures. Internal temperatures are much higher. The Sun, for example, is around 15 million degrees at its center. "This diagram is a plot of 22,000 stars from the Hipparcos Catalogue together with 1000 low-luminosity stars (red and white dwarfs) from the Gliese Catalogue of Nearby Stars. The ordinary hydrogen-burning stars like the Sun are found in a band running from top-left to bottom-right called the Main Sequence. Giant stars form their own clump on the upper-right side of the diagram. Above them lie the much rarer bright giants, supergiants and hypergiants. At the lower-left is the band of white dwarfs - these are the dead cores of old stars which have no internal energy source and over billions of years slowly cool down towards the bottom-right of the diagram."