I'm confused about the octet rule. As far as I understand, you need to complete the valence shell of the elements by sharing electrons.
Now, carbon has 6 electrons which means it has 4 valence electrons, but because it has 6 electrons in total it exceeds the first shell with 4 electrons. The second shell has 4 orbitals with 2 electrons each, so to complete the second shell I need 8 valence electrons, but I had read somewhere that the octet rule holds true until down to the 4th period. How can that be when say, magnesium, has 12 total electrons and thus it exceeds the the second shell with 4 electrons but the third shell needs 18 valence electrons to be complete, not just 8?
Secondly, I read that if the central atom has more then 8 electrons, then that's ok too? What happens if I have a choice of exceeding the 8 electrons by forming another bond with an adjacent atom or sticking those electrons on the opposite side of the adjacent atom?
Is one strictly wrong/preferable?