How do electrons fill their electron energy levels?
1 Answer
The innermost energy level (s-block) can only hold 2 electrons.
The next shell (p-block) fills up to 8.
Transition metals (d-block) and up can hold 18 electrons (look at the length of the periodic table; count the squares in each row) from the 3rd shell.
The next set, the lanthanides and actinides (f-block) fill up even more, to 32 electrons from the 4th shell onwards.
Most of the time you won't need to use f-block or even d-block depending upon your level, so you may just need the configuration 2,8,8: the shells fill up by 2, then 8, 8, 8...
Once you get to the 4th row transition metals, you go back to the 3rd shell to fill it up to 18, before you move back to the 4th shell again. The same for f-block - you go back from the 5th row to the 4th shell to fill it to 32 electrons, before going back to the 5th shell.
I hope that answers your question some amount. It's a complex topic and a broad question.