This slow process can be quickened by a passing star or shockwave from a supernova. As the cloud collapses, it starts to swirl. Over millions of years, more hydrogen gas is pulled in the spinning cloud. The collisions, which occur between the hydrogen atoms, start to heat the gas in the cloud. Once the temperature reaches 15, 000, 000 degrees celcius, nuclear fusion may begin in the core.
Nuclear fusion occurs when atoms fuse to form an element with larger atoms, releasing large amounts of energy. In this case, nuclear fusion will form the heavier element, Helium. This causes the cloud to glow and form a protostar. The protostar will stop collapsing at this point because of the energy surge from fusion, which flows out of core, stopping its collapse. The protostar will continue to gain mass (which varies depending on the matter available in the nebula), until it is stabilized. At this point the protostar will become what is known as a main-sequence star, which may last millions and maybe even billions of years to come.
Some examples of nebulae: