electronic configuration

Hello, why in the normal atomic configuration every layer except the second can contain only up to 8 electrons if for example the level with quantic number 3 contain up to 18 electrons?
What relation is there between this two models?

Thank you!
 PhysOrg.com physics news on PhysOrg.com >> Study provides better understanding of water's freezing behavior at nanoscale>> Soft matter offers new ways to study how ordered materials arrange themselves>> Making quantum encryption practical
 Recognitions: Science Advisor You have the K,L,M,N (and so on) shells, which contain 2,8,18,32.. electrons. Those numbers come from the sub-shells which make up the shells, which are denoted s,p,d,f. The sub-shells contain 2, 6, 10, 14 electrons, respectively. (twice the odd numbers 1,3,5,7) The K shell contains only an s sub-shell, so it has two electrons in total. The L shell has one s and one p, giving 2+6=8 electrons in total. The M shell has an s,p and d, so 2+6+10 = 18, and the N shell has an f sub-shell as well, so 2+6+10+14 = 32 electrons.
 An electron in the last layer require less energy to be removed, so why the last layer has more energy than the layer nearest the nucleum?