Here's how it happens:
1. Gravitational Collapse: Within a nebula, areas with slightly higher density of gas and dust experience a stronger gravitational pull. This pull attracts more matter, increasing the density further.
2. Core Formation: As the cloud collapses, it spins faster and heats up. The core of the collapsing cloud becomes extremely dense and hot.
3. Nuclear Fusion: When the core reaches a critical temperature and pressure, nuclear fusion begins. This is a process where hydrogen atoms fuse together to form helium, releasing a tremendous amount of energy.
4. Star Birth: The energy from nuclear fusion creates outward pressure that balances the inward pull of gravity. This stabilizes the core and marks the birth of a star.
The process of star formation can take millions of years. The size and mass of the resulting star depend on the size and mass of the original nebula.