Recent discovery of HfO2-based ferroelectric thin films makes it possible to realize one-transistor memory cells that offer attractive features such as low power, high speed, small cell size, scalability and CMOS compatibility. As is demonstrated by different experimental characterization methods, ferroelectricity in HfO2 arises from the creation of a polar orthorhombic phase (space group: Pca21) that is generated during the rapid annealing process with the help of a suitable capping electrode. This electrode (typically TiN) provides the confinement that is believed to be essential in the formation of the polar phase. It has also been demonstrated that the polarization in HfO2 thin film is affected by different fabrication conditions, such as doping species and doping concentration in the oxide, annealing temperature, film thickness etc. Some of the effects of these factors on the film polarization are not yet fully understood. Because the relative ratio of the orthorhombic phase over the non-polar phases determines the functionality of FE-HfO2 devices, a thorough understanding of what decides this ratio is crucial in optimizing the growth procedure that yields the best performing oxide film. To this end, in this ab initio study, we investigate the energetics of different bulk phases of HfO2 with varying amounts of Si and Zr doping and different epitaxial strain states. These results, together with additional analysis, help explain the common experimental observations as well as some of the underlying causes from an atomic structure viewpoint. We also describe preliminary results on simulated HfO2 thin films including the interface with the electrode to get a more comprehensive understanding of the energetics in thin films.