Lifting idempotents modulo a nilpotent ideal The problem is this: 

Suppose $I \subseteq R$ is a nilpotent ideal and there is $r \in R$ with $r \equiv r^2 \pmod I$. Show $r \equiv e \pmod I$ for some $e \in R$ idempotent.

I have spent a few hours rolling around in abstracta with no destination. I believe that if I could write down a concrete example of this, the example could guide me through the abstract definitions and show me where to look for an idempotent in $R$. I have looked at 2x2 matrices and could not find any such examples. Might anybody have one?  
 A: Note that we may assume that $R$ is generated by $r$ (if not, just restrict the problem to the subring generated by $r$).  In particular, this lets us assume that $R$ is commutative, which makes the machinery of algebraic geometry available.  But this result is basically trivial in the language of algebraic geometry, using the correspondence between idempotents and clopen subsets.
In detail, since $I$ is contained in the nilradical of $R$, the quotient map $q:R\to R/I$ induces a homeomorphism $q^*:\operatorname{Spec} R/I\to \operatorname{Spec} R$.  Now, an idempotent element of a ring corresponds to a clopen subset of its spectrum, with the idempotent element being $1$ on the clopen subset and $0$ on the complement.  So there is some clopen subset $A\subseteq\operatorname{Spec} R/I$ such that $q(r)$ is $1$ on $A$ and $0$ on the complement of $A$.  But then $q^*(A)$ is a clopen subset of $\operatorname{Spec} R$, so there is some element $e\in R$ which is $1$ on $q^*(A)$ and $0$ on its complement.  This $e$ will then be idempotent, and $q(e)=q(r)$ (since they are both $1$ on $A$ and $0$ on its complement) and so $e-r\in I$.
(As is typical in this sort of argument, much of the real work is hidden in the proof that the structure sheaf of Spec of a ring really is a sheaf.  Indeed, that is what we are using to construct the element $e$, by gluing together sections of the structure sheaf of $\operatorname{Spec} R$ over $A$ and its complement.)
A: The proof I've seen is a sort of surgery that is not hard, but also not obvious. I will adjust notation a bit:
Suppose $\bar r$ is idempotent in $R/I$, and consider its preimage $r\in R$. To make things easier to look at, define $s=1-r$. Notice that $\bar s$ is also an idempotent in $R/I$, and $\bar r + \bar s \equiv \bar 1$.
We have that $rs=r-r^2\in I$, and obviously $rs=sr$, so there's some $k$ such that $r^ks^k=0$. Since $\bar r^k+\bar s^k\equiv \bar r+\bar s\equiv \bar 1$, we have $x=1-r^k-s^k\in I$ is nilpotent, and then $1-x=r^k+s^k$ is invertible in $R$, with inverse $u=1+x+x^2+\ldots +x^{l-1}$ where $x^l=0$. Notice that $\bar u\equiv\bar1$, and $u$ commutes with $r$ and $s$ (since $x$ does).
Finally, we have $ur^k+us^k=1$. Multiplying both sides by $ur^k$ we see $(ur^k)^2+u^2r^ks^k=ur^k$, but $u^2r^ks^k=0$ by our efforts. Furthermore $\overline{ur^k}\equiv\bar u\bar r^k\equiv\bar 1\bar r\equiv \bar r$.
