If $P^2=P$, then
\begin{align}
\lambda(\lambda-1)I&=\lambda(\lambda-1)I-P(P-I) \\
&=\lambda^2I-\lambda I-P^2+P \\
&=(\lambda^2 I-P^2)-(\lambda I-P) \\
&=(\lambda I-P)(\lambda I+P)-(\lambda I-P) \\
&=(\lambda I-P)((\lambda-1)I+P)
\end{align}
Therefore, the resolvent of $P$ is defined for $\lambda\notin\{0,1\}$ by
\begin{align}
(\lambda I-P)^{-1}=\frac{1}{\lambda(\lambda-1)}((\lambda-1)I+P)
\end{align}
The spectrum can be $\{0\},\{1\},\{0,1\}$.
NOTE: This technique works for any operator $P$ such that $p(P)=0$ for some polynomial $p$, which includes all $n\times n$ matrices because the characteristic polynomial is such a polynomial. But it also covers operators in infinite dimensions that are annihilated by a polynomial $p(\lambda)$, such as a projection. The technique for finding the resolvent $(\lambda I-A)^{-1}$ amounts to looking at the annihilating polynomial $p$ and writing
$$
p(\lambda)-p(\mu)=(\lambda-\mu)q(\lambda,\mu)
$$
and substituting $\mu=A$, and using $p(A)=0$:
$$
p(\lambda)I = (\lambda I-A)q(\lambda,A) \\
I=(\lambda I-A)\left[\frac{1}{p(\lambda)}q(\lambda,A)\right]=\left[\frac{1}{p(\lambda)}q(\lambda,A)\right](\lambda I-A)
$$
This works for all $\lambda$ for which $p(\lambda)\ne 0$ and gives the two-sided inverse:
$$
(\lambda I-A)^{-1}=\frac{1}{p(\lambda)}q(\lambda,A).
$$
This also works for all matrices over $\mathbb{C}$ by setting $p$ equal to the characteristic or minimal polynomial.