Ill start with your second question because it's a little bit simpler.
The pattern for electron shells is 2, 8, 18, 32, 32, 18, 8 really you only need to know the first 3 or so for basic use because they don't always fill shells before they go into the next. For example element 20 is calcium...