  Elucidating the microscopic mechanisms responsible for the charge density
wave (CDW) instability of the AV$_3$Sb$_5$ (A=Cs, K, Rb) family of kagome
metals is critical for understanding their unique properties, including
superconductivity. In these compounds, distinct CDW phases with wave-vectors at
the $M$ and $L$ points are energetically favorable, opening the possibility of
tuning the type of CDW order by appropriate external parameters. Here, we shed
light on the CDW landscape of CsV$_3$Sb$_5$ via a combination of
first-principles calculations and phenomenology, which consists of extracting
the coefficients of the CDW Landau free-energy expansion from density
functional theory. We find that while the main structural distortions of the
kagome lattice in the staggered tri-hexagonal CDW phase are along the
nearest-neighbor V-V bonds, distortions associated with the Sb ions play a
defining role in the energy gain in this and all other CDW states. Moreover,
the coupling between ionic displacements from different unit cells is small,
thus explaining the existence of multiple CDW instabilities with different
modulations along the c-axis. We also investigate how pressure and temperature
impact the CDW phase of CsV$_3$Sb$_5$. Increasing pressure does not change the
staggered tri-hexagonal CDW ground state, even though the $M$-point CDW
instability disappears before the $L$-point one, a behavior that we attribute
to the large nonlinear coupling between the order parameters. Upon changing the
temperature, we find a narrow regime in which another transition can take
place, toward a tri-hexagonal Star-of-David CDW phase. We discuss the
implications of our results by comparing them with experiments on this
compound.
