Using gram schmidt, build an orthogonal basis for S. Then build a basis for P. (Since P could have uncountably many dimensions, we can't say any more about its basis, other than the fact that it exists, and even that requires the axiom of choice.) Take the union to find a larger basis b, and suppose some vector v is not spanned by b. Use gram schmidt again to move v onto a vector w that is orthogonal to S. Now w is in P, yet w and v differ by vectors in S, hence v is spanned after all. Together, S and P span the entire space.
Suppose some vector v is perpendicular to P, but not in S. Write v as a linear combination of basis vectors, something like this.
c1p1 + c2p2 + c3p3 + c4s4 + c5s5
Take the dot product with any py in P and the last two terms drop out, hence c1p1+c2p2+c3p3 is perpendicular to P. This vector is perpendicular to p1, and to p2, and to p3, hence it is perpendicular to any linear combination of these three vectors. In particular, it is perpendicular to itself, which is impossible for a nonzero vector. Therefore the space perpendicular to P is precisely S.