Because all of the elements arranged by the increasing number of electrons on their last layer. Each period ends when the appropriate layer is finished. Also, a number of the period is equal to the number of principal quantum number of the layer, which is currently last.
- The first period has only two atoms: Hydrogen and Helium. This is the first period, so that means, that principal quantum number (n) of all atoms within that period is 1. For n=1 we can have only 2 possible combinations of all other quantum numbers: l=0, ml=0, ms=+1/2 or -1/2. So, when two electrons placed on the first layer, the third electron can’t fit the same level and goes to the second, with appropriate increasing of the main quantum number. At this point, the first period ends and the second period begins.
- For second period we can have 8 possible combinations of electronic quantum numbers: s=2, l=0 or 1, ml=0 or -1,0,1, ms=+1/2 or -1/2. In the first two atoms of the period, electrons placed onto the orbital with the lowest energy (s orbital). It corresponds to azimuthal quantum number l=0 and can hold up to 2 electrons. After that electrons go to the p orbital (with higher energy), with azimuthal quantum number l=1. Such orbital can hold up to 6 electrons. So, when the last electron is placed onto p orbital, there is no empty space left for any electrons. So they must go to the third layer, with principal quantum number 3, and at that point, the third period ends.
- The third period looks like second (8 electrons too), but principal quantum number n=3 allows the existence of additional orbital, called d orbital with an azimuthal quantum number equal to 2. It can hold up to 10 electrons but have relatively high energy, so it’s empty for the third period. It begins to fill later when 4s orbital is filled. And because of that, the fourth period has 18 electrons in total.
- A principal quantum number equal to 4 allows also f orbital, with l=3, but it also has too high energy relative to other orbitals on the fourth layer, so it begins to fill only at the sixth layer, after Lanthanum. This orbital (f) can hold up to 14 electrons, so 6th and 7th periods have 32 electrons in total and 32 elements in total.