Here$\DeclareMathOperator\diag{diag}\DeclareMathOperator\rank{rank}$Here is how we can construct solutions in $P$.
Necessarily, $r\leq d,rank(P)=r,rank(S)=r_1\geq r$$r\leq d$, $\rank(P)=r$, $\rank(S)=r_1\geq r$.
There is $Q$ invertible s.t. $QAQ^T=I_d,QSQ^T=diag((\lambda_i)_{i\leq p_1},(-\mu_j)_{j\leq q_1},0_{s})$$QAQ^T=I_d$, $QSQ^T=\diag((\lambda_i)_{i\leq p_1},(-\mu_j)_{j\leq q_1},0_{s})$, where $\lambda_i,\mu_j>0$ and $p_1+q_1=r_1,p_1+q_1+s=d$$p_1+q_1=r_1$, $p_1+q_1+s=d$.
Let $p,q$$p$, $q$ be s.t. $p\leq p_1,q\leq q_1,p+q=r$$p\leq p_1$, $q\leq q_1$, $p+q=r$. Even if it means changing the ordering of the diagonal of $QSQ^T$, we may assume that the first $p$ elements of this diagonal are $>0$ and the following $q$ are $<0$.
Let $D\in M_{r,d}$ be the "diagonal" matrix $diag((d_i)_{i\leq r})$$\diag((d_i)_{i\leq r})$.
Then $U=DQAQ^TD^T=diag((d_i)^2),V=DQSQ^TD^T=diag((\lambda_i d_i^2),(-\mu_j d_j^2))$$U=DQAQ^TD^T=\diag((d_i)^2)$, $V=DQSQ^TD^T=\diag((\lambda_i d_i^2),(-\mu_j d_j^2))$.
Finally $U^{-1}VU^{-1}=diag((\dfrac{\lambda_i}{d_i^2})_{i\leq p},(\dfrac{-\mu_j}{d_j^2})_{j\leq q})$$U^{-1}VU^{-1}=\diag\left(\left(\dfrac{\lambda_i}{d_i^2}\right)_{i\leq p},\left(\dfrac{-\mu_j}{d_j^2}\right)_{j\leq q}\right)$ and we choose $d_i=\sqrt{\lambda_i},d_j=\sqrt{\mu_j}$$d_i=\sqrt{\lambda_i},d_j=\sqrt{\vphantom\lambda\mu_j}$.
For $P=DQ$, the considered expression is $diag(I_p,-I_q)$$\diag(I_p,-I_q)$ and we are done.