Accretion disk
Stars are formed in nebulae, interstellar clouds of dust and gas (mostly hydrogen). These stellar nurseries are abundant in the arms of spiral galaxies.
In these stellar nurseries, dense parts of these clouds undergo gravitational collapse and compress to form a rotating gas globule.
The globule is cooled by emitting radio waves and infrared radiation. It is compressed by gravitational forces and also by shock waves of pressure from supernova or the hot gas released from nearby bright stars. These forces cause the roughly-spherical globule to collapse and rotate. The process of collapse takes from between 10,000 to 1,000,000 years.
A central core and a protoplanetary disk
As the collapse proceeds, the temperature and pressure within the globule increases, as the atoms are in closer proximity. Also, the globule rotates faster and faster. This spinning action causes an increase in centrifugal forces (a radial force on spinning objects) that causes the globule to have a central core and a surrounding flattened disk of dust (called a protoplanetary disk or accretion disk). The central core becomes the star; the protoplanetary disk may eventually coalesce into orbiting planets, asteroids, etc.
Protostar
The contracting cloud heats up due to friction and forms a glowing protostar; this stage lasts for roughly 50 million years. If there is enough material in the protostar, the gravitational collapse and the heating continue.
If there is not enough material in the protostar, one possible outcome is a brown dwarf (a large, not-very-luminous celestial body having a mass between 1028 kg and 84 x 1028 kg).
A newborn star
When a temperature of about 27,000,000°F is reached, nuclear fusion begins. This is the nuclear reaction in which hydrogen atoms are converted to helium atoms plus energy. This energy (radiation) production prevents further contraction of the star.
Young stars emit jets of intense radiation that heat the surrounding matter to the point at which it glows brightly. These narrowly-focused jets can be trillions of miles long and can travel at 500,000 miles per hour. These jets may be focused by the star’s magnetic field.
The protostar is now a stable main sequence star which will remain in this state for about 10 billion years. After that, the hydrogen fuel is depleted and the star begins to die.
Life span
The most massive stars have the shortest lives. Stars that are 25 to 50 times that of the Sun live for only a few million years. Stars like our Sun live for about 10 billion years. Stars less massive than the Sun have even longer life spans.