If the gravitational energy of a mass of gas is greater than the average kinetic energy of random thermal motion of the constituent, mostly hydrogen molecules the mass will tend to collapse in on itself. As it does so, the thermal energy occupies a smaller volume and the gas will tend to heat up.
This is the Jeans Criterion
If the energy emitted is enough for the temperature to rise so that the object glows it is called a protostar. Equalising the two sides and using the density above and 100K as the temperature, a simple substitution shows that a mass of gas equivalent to 1500 solar masses would be required. This could obviously fuel several stars.
As gravitational collapse is balanced by outward radiation pressure, fusion then begins to occur at about 5-10 million kelvin, the object attains optimal size, releasing large amounts of electromagnetic energy and the star glows like a black body with a characteristically stable temperature profile for billions of years.
where the power alpha is a number between three and four, dependent on star type.
We can use this to estimate the lifetime of the star on the Main Sequence