The Pauli exclusion principle allows us to approximate the wave functions of valence electrons by treating the inner electrons and nucleus together as a single source of potential; and then by treating the ionic cores as fixed we can solve the Schrodinger equation for the valence electrons and calculate its lowest energy level as a function of the relative coordinates of the cores. Minimizing that function then allows us to determine the optimal bond lengths and their relative orientations.

Source: (1001) Alan Cooper’s answer to How does quantum mechanics treat atomic bonds, and what role does the Pauli exclusion principle play in this context, considering also that electrons are everywhere in space according to their wave function rather than confined to fixed orbits? – Quora