|Intergalactic space is filled with
clouds of gas
(mostly H + He) and dust known as molecular clouds.
These clouds are supported against gravitational collapse by their thermal pressure, but if the clouds get too big massive, gravity wins and they can start to collapse. This is the first step towards star formation.
Once started, how does the collapse form a star and the disk of material surrounding it?
Gravity is a central force -- it draws material in radially. So why doesn't it all collapse into a ball?
All clouds rotate, at least a little, due to gravitational shearing in the galaxy's disk. And if a cloud rotates, it has angular momentum: L ~ mrv.
And remember that angular momentum is conserved. So if a rotating cloud collapses (r gets smaller) than it must spin faster (v gets bigger). Even a little pre-collapse spin goes a long way!
How does rotation affect collapse? It adds a centripetal force term to the collapse. For a particle of mass m on the edge of the cloud, the force on it depends whether it is on the rotation pole or the equator:
So as the cloud collapses, material along the spin axis can collapse onto the star, but material in the spin plane has collapse halted by centripetal force. A disk is formed!
What about the central mass -- the protostar itself?
As a ball of gas collapses, its gravitational potential energy changes. Half of this change is radiated away, the other half heats up the collapsing cloud.
So the very central portions of the cloud are getting denser and hotter. Eventually the density and temperature will become high enough that nuclear reactions will begin to take place. A star is born!
The high central density and temperature also create sufficient pressure (via the ideal gas law) inside the star to halt gravitational collapse. The young star is now in hydrostatic equilibrium.
Yes! We see these stars and young disks in nearby star forming regions:
The Orion Nebula
Proplyds (Proto Planetary Disks) in the Orion star forming cloud
What is it made of?
It came from the same collapsing cloud which formed the Sun, so it should have the same chemical composition as the Sun. Mostly hydrogen and helium, with much smaller amounts of heavier elements: carbon, nitrogen, silicon, sulfur, iron, etc.How hot was it?
Also, the chemical composition of meteorites is similar to the Sun, minus the volatile elements such as hydrogen, helium, and other gases.
So the early solar nebula was very hot, and cooled rapidly.
Eventually, the stellar wind and radiation pressure from the central star blew much of the material out of the inner solar system (remember the physics of comet tails?). But before that happens, we need to start making planets...