Let $A$ be a $C^*$-algebra, $p\in A$ a projection, and $a\in A$ self-adjoint. Let $\Gamma$ be the circle of radius $1/2$ with center $1$. It is claimed that
$$\frac{1}{2\pi i}\int_\Gamma(z-p)^{-1}a(z-p)^{-1}\,dz=pa(1-p)+(1-p)ap.$$
I'm looking for a hint to prove this.
Comment: I understand that $$\frac{1}{2\pi i}\int_\Gamma(z-p)^{-1}\,dz=p,$$ hence $pa(1-p)=\frac{1}{2\pi i}\int_\Gamma\frac{a(1-p)}{z-p}\,dz$ and $(1-p)ap=\frac{1}{2\pi i}\int_\Gamma\frac{(1-p)a}{z-p}\,dz$. So $$pa(1-p)+(1-p)ap=\frac{1}{2\pi i}\int_\Gamma\frac{a(1-p)(z-p)+(1-p)a(z-p)}{(z-p)^2}\,dz.$$ But I'm not sure if this is the way.
Since things do not commute, you have to be careful as the expressions in your integrals are ambiguous when you write a quotient.
You have, for $z\not \in\{0,1\}$, $$ (z-p)^{-1}=\frac1z\,(1-p)-\frac1{1-z}\,p. $$ Now you can compute $(z-p)^{-1}a(z-p)^{-1}$ and integrate, using that the curve encloses $1$ and not $0$,