Atoms are divided into levels of energy. Energy levels are the regions around the nucleus where electrons are likely to be moving. Electrons can move between one level to another, but cannot be in between levels. To move from one level to another, the electron must gain or lose the right amount of energy.
A Quantum is the amount of energy required to move an electron to the next highest energy level. Energy levels grow closer as they move further away from the nucleus.
The number of electrons vary from element to element, obviously. For example, Oxygen (O) has 8 electrons in it. This is determined by subtracting the number of protons(8) from the Atomic mass(16.00).
This is where electron configuration comes in.
The levels contain orbitals, which can hold a certain number of electrons. There are four different orbitals:
The lowest energy level has one sublevel - the S, and the second has two, and so on. S orbitals can only hold 2 electrons, P can hold 6, D can hold 10, and F can hold 14.
5s 5p 5d 5f
4s 4p 4d 4f
3s 3p 3d
So, if Chlorine (Cl) has 17 electrons, it's electron configuration is
As you see, the last orbital isn't filled all the way, and that's ok. The Aufbau principle states that elctrons enter the orbitals of lowest energy first. Also, the Pauli exlusion principle states that electrons in the same orbital must have opposite spins.