In this review, we describe our current understanding of cluster formation: from the general picture of collapse from initial density fluctuations in an expanding Universe to detailed simulations of cluster formation including the effects of galaxy formation. We outline both the areas in which highly accurate predictions of theoretical models can be obtained and areas where predictions are uncertain due to uncertain physics of galaxy formation and feedback. The former includes the description of the structural properties of the dark matter halos hosting cluster, their mass function and clustering properties. Their study provides a foundation for cosmological applications of clusters and for testing the fundamental assumptions of the standard model of structure formation. The latter includes the description of the total gas and stellar fractions, the thermodynamical and non-thermal processes in the intracluster plasma. Their study serves as a testing ground for galaxy formation models and plasma physics. In this context, we identify a suitable radial range where the observed thermal properties of the intra-cluster plasma exhibit the most regular behavior and thus can be used to define robust observational proxies for the total cluster mass. We put particular emphasis on examining assumptions and limitations of the widely used self-similar model of clusters. Finally, we discuss the formation of clusters in non-standard cosmological models, such as non-Gaussian models for the initial density field and models with modified gravity, along with prospects for testing these alternative scenarios with large cluster surveys in the near future.