In this work, the results of first-principles density-functional-theory calculations are used to construct the energy landscapes of HfO$_2$ and its Y and Zr substituted derivatives as a function of symmetry-adapted lattice-mode amplitudes. These complex energy landscapes possess multiple local minima, corresponding to the tetragonal, oIII ($Pca2_1$), and oIV ($Pmn2_1$) phases. We find that the energy barrier between the non-polar tetragonal phase and the ferroelectric oIII phase can be lowered by Y and Zr substitution. In Hf$_{0.5}$Zr$_{0.5}$O$_2$ with an ordered cation arrangement, Zr substitution makes the oIV phase unstable, and it become an intermediate state in the tetragonal to oIII phase transition. Using these energy landscapes, we interpret the structural transformations and hysteresis loops computed for electric-field cycles with various choices of field direction. The implications of these results for interpreting experimental observations, such as the wake-up and split-up effects, are also discussed. These results and analysis deepen our understanding of the origin of ferroelectricity and field cycling behaviors in HfO$_2$-based films, and allow us to propose strategies for improving their functional properties.