So, the answer is basically, you need a rather complicated model before you can really do this.
We can start by describing the Hydrogen atom with number operators for the different states; it takes the form:$$\hat H_0 = -\frac{m_e c^2 Z^2 \alpha^2}{2} \sum_{\sigma\in\{\uparrow,\downarrow\}} \left[\hat s_{1\sigma} + \frac 14\left(\hat s_{2\sigma} \hat s_{2\sigma} + \hat p_{1,2\sigma} + \hat p_{2,2\sigma} + \hat p_{3,2\sigma} \right) + \frac 19 \left\{s_3,p_3,d_3\right\} + \dots\right].$$So this doesn't even say why $s$ orbitals would get filled first, and in fact for many elements our understanding of their geometry involves heuristic arguments about $sp, sp^2, sp^3$ hybridizations giving them geometries looking respectively like lines, equilateral triangles, and tetrahedrons. But it does say that if you have a lot of electrons over by atom #1 in some orbital, and atom #2 has a lower-energy orbital, electrons will flow from atom #1's orbital to atom #2's orbital, and this will tend to stop at orbital boundaries.
So we can already see that atoms "prefer" an orbital to be empty/full based on pure energy-minimization behavior. It's just that if you can accept one atom, you can accept more, until those orbitals are full.
Now this does not explain something crucial about the periodic table, which is that $d$-orbitals actually don't get filled until after the $s$ orbitals of the next energy level. To understand this we need to think about the so-called fine structure in the Hydrogen atom. The leading term of this is due to relativity, causing $p$ orbitals to have higher energy than $s$ ones and $d$ to have higher energy than $p$. The exact formula for these energies was worked out by Dirac, where $j$ is the sum of the spin and angular momentum quantum numbers as$$E(n,j) = \frac {m_e c^2}{\sqrt{1+\left(\dfrac{\alpha Z}{n-|j + 1/2|+\sqrt{(j+1/2)^2-\alpha^2Z^2}}\right)^2}}~~. $$Complicated! But basically it's saying that as angular momentum increases, the stuff in parentheses decreases, so the energy as a whole increases. (There are second-order terms also due to the Lamb shift and spin interactions with the nucleus and such, as well, which can bump up the $\epsilon$ for the $p$ orbitals and for one of the spin directions, say $\sigma = \uparrow$. These may actually be important for understanding the problem but usually their sizes, measured in eV, are pretty small.)
But there's another huge factor which we're not considering here. The Hamiltonian I just wrote is analytically derived for an atom with one electron. Real atoms have many electrons, and they interact. Perhaps the simplest example of this is the fact that fluorine is more electronegative ("grabby") than chlorine and bromine etc. Why would that be? I mean, for the topmost electron orbitals, we have some sort of energy dependence like $-Z^2/n^2$. How is $n$ growing with $Z$? The sequence $0, 1, 1 + (1 + 3), 1 + (1 + 3) + (1 + 3 + 5), \dots$ is growing as a sum-of-a-sum-of odd numbers; the sum of the first k odd numbers is the k'th square number; so we're summing k^2 and we should therefore get something like $n^3/3 = Z/2$, or $n \approx (\frac 32Z)^{1/3}$. So for each $n$, $-Z^2/n^2 \propto -Z^{2-(2/3)} = -Z^{4/3}$. So shouldn't bigger nuclei be lower energy and hence more grabby? And the answer is, of course they're not, because the electrons in that nucleus have a corresponding charge $-Z~e$ that repels incoming electrons.
The easiest way to model this is with some sense of electron screening: we know that for $1/r^2$ laws like Coulomb's law or Newtonian gravitation, the force inside a spherical shell of mass/charge $m$ due to that shell averages out to 0. Now from the Hydrogen atom solution we know that the falloff in $|\psi|^2$ is $\exp(-2 Z r / (n a_0))$, so the radius mostly just increases with $n$. (Disclaimer: there is probably also an effect due to the angular momentum coming from the Laguerre polynomials; if you really wanted to make the claim that I'm making now you'd calculate $\sqrt{\langle \psi| r^2 |\psi \rangle}$ and this answer is long enough without that. The relativistic case is even more complicated and does have some angular-momentum dependence in the exponential decay, too.)
So we'd expect to reduce $Z$ commensurately with that screening: perhaps heuristically by modifying $Z$ to an n-dependent $Z_n$ defined by:$$Z_N \approx Z - \{\text{# of electrons with n < N}\} - \frac{1}{2} \{\text{# of electrons with n = N}\}.$$Suppose now that you want to add an electron to a noble gas: this heuristic actually says that this has energy $0$, as $Z_{n+1} = 0$ for that orbital; the atom is totally screened. But a full halogen can still attract a new electron into its last orbital with an effective nuclear charge of $\frac 12 ~n(Z) ~ e$, since the new electron will get to live half-under and half-over all of the electrons in the $n(Z)$ orbital. As was said earlier, we can expect this to scale like the cube root of $Z$ or so.