Each shell can contain only a fixed number of electrons: The first shell can hold up to two electrons, the second shell can hold up to eight (2 + 6) electrons, the third shell can hold up to 18 (2 + 6 + 10) and so on.
Phosphorus has 15 total electrons. Its first shell can hold 2 electrons. Its second shell can hold 8 electrons. The remaining 5 electrons are in its third shell (the third shell can hold up to 18 electrons).
2 electrons (1st shell) + 8 electrons (2nd shell) + 5 electrons (3rd shell) = 15 total electrons (the number of electrons P has).