The formation of stars is a key process in astrophysics. Detailed knowledge of the physical mechanisms that govern stellar birth is a prerequisite for understanding the formation and evolution of our galactic home, the Milky Way. A theory of star formation is an essential part of any model for the origin of our solar system and of planets around other stars. Despite this pivotal importance, and despite many decades of research, our understanding of the processes that initiate and regulate star formation is still limited. Stars are born in cold interstellar clouds of molecular hydrogen gas. Star formation in these clouds is governed by the complex interplay between the gravitational attraction in the gas and agents such as turbulence, magnetic fields, radiation and thermal pressure that resist compression. The competition between these processes determines both the locations at which young stars form and how much mass they ultimately accrete. It plays out over many orders of magnitude in space and time, ranging from galactic to stellar scales. In addition, star formation is a highly stochastic process in which rare and hard-to-predict events, such as the formation of very massive stars and the resulting feedback, can play a dominant role in determining the evolution of a star-forming cloud. As a consequence of the wide range of scales and processes that control star formation, analytic models are usually restricted to highly idealized cases. These can yield insight, but the complexity of the problem means that they must be used in concert with large-scale numerical simulations. Here we summarize the state of modern star formation theory and review the recent advances in numerical simulation techniques.