'p' and 'd'.
There is one type of 's' orbital. It is spherical. So an s orbital can hold 2 electrons only.
There are three types of 'p' orbitals. They are the same shape (like a dumbell) but are oriented in different directions - along the x, y and z axes. So a 'p' orbital can hold $2$x$3$ = 6 electrons.
There are five types of 'd' orbitals (10 electrons) and seven types of 'f' orbitals (14 electrons).
Fill up the orbitals in the following order (following the red arrows), which is increasing order of energy. Lowest energy fills up first.
1s, 2s, 2p, 3s, 3p, 4s, 3d, 4p, 5s, 4d, 5p, 6s, 4f, 5d, 6p, 7s, 5f, 6d, 7p
So let's take the example of sulfur.
The total number of electrons is 16. We'll distribute them in the following manner.
$1s^2, 2s^2, 2p^6, 3s^2, 3p^4$, where the superscripts of each orbital represent the number of electrons in it. Now, we have a total of 6 electrons in the last (3rd) orbital. Therefore the valence number is 6.
It is not simply the last 2 numbers while writing the electronic configuration.
For Phosphorous, we have:
$1s^2, 2s^2, 2p^6, 3s^2, 3p^3$, which gives us 5 electrons in outermost (3rd) orbit.
For Lithium (3 electrons), we have:
$1s^2, 2s^1$, which gives us a total of 3. Outermost orbit is the 2nd orbit and the total number of electrons in it is just one. Therefore valency of Lithium is one.
However, it is much simpler to do it the way I've shown above as with Sodium. Don't need to bring in all the orbitals
For the spin, just remember that you have to fill up the entire orbital with up spin electrons before you start putting the down spin electrons. Don't just alternate up and down.
Let's talk about the 'p' orbital. Each 'type' of the p-orbital must have up-spin electrons before adding the down-spin. So there will be 3 up spin electrons before you start adding the down-spin ones. Also, you can not move on to the next orbital without completely filling the previous one with an EQUAL number of up and down spins.
For Phosphorous; let's say we've filled the 1s, 2s, and 2p orbitals. Now we add one up spin to the 3s, followed by a down-spin. Which leaves us with 3 more electrons to be added to the valence orbit (3rd). It is a 'p'-orbital, which needs to have 3 up spin electrons before any downspin ones can be accommodated. But we have only 3 remaining! So all will be up-spin electrons in the valence orbit. So we'll have a total spin of +3/2.
Hope I didn't complicate too much, but I've actually tried to make it as short as possible. I've still left out quite a bit.