The space between the stars is not empty. It holds gas, mostly hydrogen, at about one atom per cubic centimetre. That is emptier than any vacuum made on the earth, and nothing can come of it as it stands.
Here and there the gas gathers into clouds where the density climbs to thousands or millions of atoms per cubic centimetre and the temperature falls to 10 or 20 K. At that temperature hydrogen holds together as a molecule, so these are called molecular clouds.
Cold and dense is the combination that matters. Cold means the atoms move slowly and the pressure is low. Dense means the gravity is strong. Both push the same way.
Within a cloud the density is not even. Star formation happens in the densest cores, which are a fraction of a light year across and hold a few times the mass of the sun.
A clump of gas has two things acting on it. Its own gravity pulls it inward and its pressure pushes it outward. Which one wins is not a matter of degree. There is a definite mass at which the balance tips.
Below that mass, squeeze the clump and the pressure rises faster than the gravity does, so it springs back. Above it, squeeze the clump and the gravity gains faster, so it keeps going. The collapse is a runaway.
The threshold is the Jeans mass, and it goes as M_{\mathrm{J}} \propto T^{3/2} \rho^{-1/2}. Colder gas and denser gas both lower it, which is why the cold dense cores are where stars appear.
Once a core is over the line, nothing in it can hold it up. The collapse takes something like a hundred thousand years, which is quick by the standards of a star.
The gas does not fall straight in. Every cloud is turning a little, and as it shrinks that turn speeds up, for the same reason a skater turning slowly speeds up on pulling the arms in.
Along the axis of the turn there is nothing to stop the fall, so the gas comes straight down. Out at the equator the turning holds it up, and it settles into a disc instead. The result is a growing lump at the middle with a flat disc round it.
The disc is where planets are made later, out of the material that never reached the middle. Every planetary system began as one of these.
Something has to carry off the excess turning, or the disc would never drain into the star. Part of the answer is a pair of jets fired along the axis, and they are one of the clearest signs that a star is being born inside a cloud too thick to see into.
Falling gas gives up gravitational energy, and that energy ends up as heat in the middle. So the more the object contracts, the hotter its center becomes. At this stage it is a protostar: it shines, but only on the heat of its own collapse.
That source cannot last. For an object the size of the sun it would run out in tens of millions of years, which is nothing. Something else has to take over.
The center keeps climbing, and at about 10^{7} K the hydrogen nuclei start to fuse. From that moment the star has a source that will hold for billions of years.
The contraction stops there, and not by coincidence. The new energy raises the pressure until it matches the weight above, and that is the hydrostatic balance of the previous article. The star has arrived at the state it will keep for most of its life.
Put the whole story on the HR diagram and it reads as one path. A protostar is large and its surface is cool, so it starts far over on the right, and it is bright because it is large, so it starts high as well.
As it contracts the surface area falls, so the luminosity falls with it while the temperature barely moves. On the diagram the object drops almost straight down.
When fusion lights, the contraction stops and the point stops with it. Where it stops is the main sequence, and which point of the main sequence is decided by the mass alone, as the article on mass and lifetime set out.
The line the stars land on is called the zero age main sequence. Everything on the band arrived there this way, and everything on the band will leave it in the way the next article describes.