Atoms always want to have a closed shell, because it requires low energy compared to the lattice enthalpy. How does this always match throughout the periodic table between the number of protons and electrons?
For example, Magnesium have 12 protons, the electron configurations ends in 3s^2, so it ‘wants’ to lose 2. Barium have 56 protons, the electron configuration ends in 6s^2, so it easily loses 2. Why in bigger atoms like Barium with the electrons having greater distance from the nucleus, they be more stable losing 3 electrons for example, and so it had 56 protons and 53 electrons instead of 54? Or for example the noble gases in the last groups be stable with more or less one electron? It’s like this orbitals rules described by Schrödinger equation are always respected, but the energy of attraction between proton and electron too, and they both always match perfectly.
I think what I mean is that +1 proton attracts +1 electron, and it fits in some orbital given the Pauli Exclusion Principle and Schrödinger equation. Why the relation between the strength of electromagnetic force and the Schrödinger equation always creates this stability between protons and electrons throughout the periodic table?