This primarily has to do with the balance of energy between the orbitals. The aufbau principle states that the order of energy regarding electrons in the orbitals from lowest to highest is so the electron in the atom will minimalize it's energy. Periods on the periodic table are based on the energy level while the groups have the same amount of valence electrons. The outer orbitals are refered to as shells. The elements are particularly arranged depending on their atomic and molecular orbitals. Valence electrons most determine the chemical properties of an element. The atomic number is based on the number of protons.