If electronic configuration ends in 4s, its in period 4 of the periodic table, it has 4 electron shells or energy levels. It is also in the s block, so its in groups 1 or 2, the alkali or alkaline earth metals, 4s1 would be potassium, as its in period 4 and group 1, 4s2 would be calcium as its in period 4 group 2 (alkaline earth metals).
2n^2 tells you the number of electrons in the shell or energy level, if n=4, for period 4 elements then you can have the following sub-levels in the 4th shell: 4s, 4p, 4d, 4f, and since
s sub-level holds 2e
p sub-level holds 6e
d sub-level holds 10e
f sub-level holds 14e
total of 32 e in the 4th shell or energy level, which is 2n^2, or 2 x (4^2) = 32