Molecular clouds are a fundamental ingredient of galaxies: they are the channels that transform the diffuse gas into stars. The detailed process of how they do it is not completely understood. We review the current knowledge of molecular clouds and their substructure from scales $sim~$1~kpc down to the filament and core scale. We first review the mechanisms of cloud formation from the warm diffuse interstellar medium down to the cold and dense molecular clouds, the process of molecule formation and the role of the thermal and gravitational instabilities. We also discuss the main physical mechanisms through which clouds gather their mass, and note that all of them may have a role at various stages of the process. In order to understand the dynamics of clouds we then give a critical review of the widely used virial theorem, and its relation to the measurable properties of molecular clouds. Since these properties are the tools we have for understanding the dynamical state of clouds, we critically analyse them. We finally discuss the ubiquitous filamentary structure of molecular clouds and its connection to prestellar cores and star formation.