Given an idempotent $e$ in a ring $R$, the right ideal $eR$ is projective as a right $R$-module. In fact, $eR + (1-e)R$ is actually a direct sum decomposition of $R$ as a right $R$-module. An easy nontrivial example is $\Z\oplus\Z$ with $e = (1,0)$.

Fix an $a\in R$. If $aR$ is a projective right $R$-module, however, that doesn't mean that $a$ is an idempotent. In fact $aR$ is projective whenever $a$ is a nonzerodivisor, and in this case $aR$ is just isomorphic to $R$ itself as a right $R$-module.

**So how do idempotents come into play in general?** It turns out we have to look at annihilators! The right annihilator of $e$ is the right ideal $(1-e)R$. Indeed, $e(1-e) = 0$. And, if $er = 0$, then $(1 – e)r = r$, so anything that annihilates $e$ is a multiple of $(1-e)$. So we see that the annihilator of $eR$ is $(1-e)R$.

What about in general? It turns out that if $aR$ is projective, the right annihilator of $a$ must be of the form $eR$ for an idempotent $e$. Indeed, if $aR$ is projective, then the map $R\to aR$ given by $r\mapsto ar$ has a splitting $\varphi:aR\to R$. I'll leave it as an exercise to show that the right annihilator of $a$ is $(1 – \varphi(a))R$, and that $1 – \varphi(a)$ is in fact an idempotent.

Conversely, if the right annihilator of an $a\in R$ is of the form $eR$ for some idempotent, then multiplication by $1-e$ gives the splitting of the natural map $R\to aR$, so $aR$ must be projective.