  Young stars form on a wide range of scales, producing aggregates and clusters
with various degrees of gravitational self-binding. The loose aggregates have a
hierarchical structure in both space and time that resembles interstellar
turbulence, suggesting that these stars form in only a few turbulent crossing
times with positions that map out the previous gas distribution. Dense
clusters, on the other hand, are often well mixed, as if self-gravitational
motion has erased the initial fine structure. Nevertheless, some of the
youngest dense clusters also show sub-clumping, so it may be that all stellar
clustering is related to turbulence. Some of the densest clusters may also be
triggered. The evidence for mass segregation of the stars inside clusters is
reviewed, along with various explanations for this effect. Other aspects of the
theory of cluster formation are reviewed as well, including many specific
proposals for cluster formation mechanisms. The conditions for the formation of
bound clusters are discussed. Critical star formation efficiencies can be as
low as 10% if the gas removal process is slow and the stars are born at
sub-virial speeds. Environmental conditions, particularly pressure, may affect
the fraction and masses of clusters that end up bound. Globular clusters may
form like normal open clusters but in conditions that prevailed during the
formation of the halo and bulge, or in interacting and starburst galaxies
today. Various theories for the formation of globular clusters are summarized.
