Stars are born when a swirling cloud of hydrogen gas and interstellar dust begins to coalesce into a distinct sphere. As the sphere grows, gravity compresses it more and more, and the temperature at the center rises. At some point, the gas and dust become compressed in the center to the point that the temperature is high enough to cause fusion to begin. A new star is born.
During this formative time, much more is going on. As the gas and dust coalesces, its central region begins to trap radiation so the temperature and pressure increases. A star with a mass about that of our sun, at this stage, will be much larger than the Sun, and as much as 1000 times brighter. But its temperature will be much lower than it eventually will be, as its heat at this point is supplied solely by gravitational contraction. However, it is producing light, and so is a protostar.
As the protostar continues to contract, the temperature and pressure at the core continues to increase until fusion begins. Temperatures increase further, and the core pressures increase to the point that they balance the gravitational contraction that has been pulling the gases toward the core. At this point the star is in hydrostatic equilibrium and is a full fledged star.
The basic fusion equation at work here is 2H+3H--->4He + 1n + energy, where n is a neutron.
This birth sequence holds true for stars of any mass above 0.08 solar masses, even giants many times larger than the Sun. A protostar with a mass as low as 0.08 solar masses never achieves nuclear fusion. Its heat and dim luminosity is created solely by gravitational contraction. It has a short life as a brown dwarf. Over a few thousand years it gradually cools and goes dark.
If the luminosity of a star is graphed against its temperature, all stars in their hydrogen burning phase will clump together in a long meandering grouping known as the Main Sequence. In the graph, below, (known as a Hertzsprung-Russel diagram) smaller stars are at the bottom right, and larger stars fall at the upper left of the diagram. The Sun, a fairly mid-size star, falls just about in the middle of the Main Sequence.
Notice as well, as you move through the Sequence, the color of the stars change. The smaller stars are red. Stars about the size of the Sun and up to about four solar masses are yellow. Stars larger become blue. This of course is a function of temperature.
Hydrogen burning stars larger than the small red stars at the lower end of the graph burn for billions of years, remaining in the Main Sequence throughout this period. Our Sun is expected to continue to burn its hydrogen for 10 billion years.
But eventually, all the hydrogen in the core is used up, transformed into helium. Then the star transforms.