Order of energy levels
In Atomic Levels, it was explained that each of of the each of orbitals have a different amount of energy and the electrons hate energy.
That causes the electrons to have a certain order of filling the orbitals from lowest energy to highest energy. The order in which the orbitals fill up is 1s, 2s, 2p, 3s, 3p, 4s, 3d, 4p, 5s, 4d, 5p, 6s, 4f, 5d, 6p, 7s, 5f, 6d and lastly 7p.
But there are two exceptions, namely Lanthanum and Actinium which I will explain in detail later.
The periodic table
So let us understand how the periodic table is constructed. The electrons fill up the energy levels in increasing order. The periodic table is constructed by the ascending order of amount of energy.
Now we will learn about the periodic table row by row.
The first row has elements with n=1 corresponding to the innermost orbit. The maximum value l can take is n-1 so for this orbit l must be 0 and the l=0 orbital is called the s orbital. Since m takes values -l to l with l=0, m can take only a single value which is zero. So the only address available to electrons in the n=1 orbit is |n=1,l=0,m=0>. Since the electrons hate each other each such address can accommodate at most 2 electrons of opposite spin. So the n=1 shell can only hold up to 2 electrons. That is why the first row of the periodic table has only 2 elements, namely hydrogen and helium with 1 and 2 electrons respectively.
The second row has elements with n=2 corresponding to the second orbit. The maximum value of l is 1. So m can take all the values from -1 to 1. There are now 2 orbitals s,p. The value of the p orbital has l=1. This row has 8 elements. The first element of this row lithium and the last element is Neon.
The third row has has elements with n=3 l = 0,1. But n =3 also allows for l to take the value 2. The l=2 elements are transferred to the fourth row (I will explain this later). Coming back to this row, the orbitals are s and p. So the maximum value of l is 1. So, m can take values -1 to 1. Just as in the row above, this row also has 8 elements. The first element of this row is Sodium and the last is Argon.
The fourth row includes, elements with outermost shell n = 3 and outermost shell n =4. Going back to the energy levels graph, we see that the 4s has less energy than the 3d. Since the electrons hate energy they fill the 4s orbital before the 3d orbital so in the periodic table the 3d elements are are placed after the 4s ones and before the 4p ones. Elements of the 4f and 4d do not belong to this row. The first element of this row potassium and the last is Krypton.
It the 5th row 4d elements come after the 5s ones just like 3d elements come after the 4s ones in the 4th row. So this row has 5s, 4d and 5p elements. The first element of this row is Rubidium with 37 electrons and the last one is Xenon with 54 electrons.
In the 6th row, we first have the 2, 6s elements. Then we have the first 5d element Lanthanum . After that come all the 14, 4f lanthanides that are represented by a symbol in the image above. The complete list is given separately at the bottom of the periodic table. After that come the remaining 5d elements followed by the 6p ones. The first element of this row is Cesium with 55 electrons and Radon with 86 electrons.
In the 7th row first come the 7s elements. After that we have the first 6d element which is Actinium. Following Actinium come the 14, 5f actinides represented by two symbols. The list is at the bottom of the periodic table. Next come the rest of the 6d elements followed by the by the 7p ones. The first element of this row is Francium with 87 electrons and the last one is Oganesson with 118 electrons.