Why does the Most Stable State of an Atom Tend to be One with Full s and p Subshells? I'm new to posting on stack exchange, although I've read a lot of it before. This question seems like it might end up being marked as a duplicate, but I've looked through a lot of the similar questions and I feel like I'm still not getting it (most answers end up just explaining that the octet rule is wrong).
I'm currently taking AP Chemistry and we've been talking about electron configuration. As I understand it, atoms generally are at a lowest energy state when they fill their outermost s and p subshells (resulting in the octet rule, as the 2 + 6 electrons in these shells add up to 8). As far as I can tell, this is mostly due to Coulomb's Law being stronger with a smaller radius and the shielding effect impacting how much protons pull on electrons. But what I don't understand, then, is why an atom would tend to gain electrons in order to fill its valence shell. Wouldn't the lowest energy state be to lose a whole shell and decrease the radius and the shielding effect? It would make the atom very positively charged, but that doesn't seem to be a problem for something like Si4+. For that matter, why have any electrons at all? Wouldn't the most stable state be for an atom to repeatedly lose electrons and just be a nucleus? Presumably this has to do with the ionization energy being too high, but why is that the case? If it's just as simple as because the electrons are attracted to the nucleus, why can any electrons be removed at all? What am I missing or where is the flaw in this reasoning?
P.S. I've found electron configuration really interesting so far, but we haven't been doing much of anything with the math that explains it. I'm taking multivariate calculus right now, and I would really like to learn about the math behind it all. Is it too early for me to start? If not, does anyone have any good introductory sources to learn about that?
The major factor is electrons with the same quantum numbers $\mathrm{n}$ and $\mathrm{l}$ do not mutually shield the nucleus charge well.
Elements approaching the noble gas group in the Periodic table ( $\ce{N, O, F}$ ) get nearly  fully filled respective $\mathrm{p}$ orbitals. The effectively perceived nucleus charge grows for valence electrons. It gets progressively more difficult to ionisate these electrons, and at the same time the energy released by capturing an extra electron grows.
Elements at the opposite table side ( alkaline metals and alkaline earth metals ) have the opposite situation. They start to fill orbitals at the new, higher quantum number $\mathrm{n}$ level. The lower, now fully filled $\mathrm{p}$ orbitals shield the nucleus well. Additionally, the new $\mathrm{s}$ orbital  is farther from nucleus with lower attractive force. Both effects lead to low ionization energy of such atoms and very low affinity to extra electrons.
This leads to the octet rule, which is consequence of the fact, if chemical bonds lead to completing octets, the total electron energy is lower.
It has its limits. Ionization of electrons leads to progressively increasing ionization energy for every next electron. Similarly, accepting too many electrons leads to negative electron affinity, so the electron is released at the nearest convenience. So ions with high positive charge occur only in heavily ionisating environment, respectively the one with highly negative charge need source of electrons. Even in solid matrices there is partially covalent bond.
It may be challenging, but this explains a lot about the screening of the nucleus charge: Slater's rules