  The theory of generalized inverses of matrices and operators is closely
connected with projections, i.e., idempotent (bounded) linear transformations.
We show that a similar situation occurs in any associative ring $\mathcal{R}$
with a unit $1 \neq 0$. We prove that generalized inverses in $\mathcal{R}$ are
related to idempotent group endomorphisms $\rho: \mathcal{R} \rightarrow
\mathcal{R}$, called projectors. We use these relations to give
characterizations and existence conditions for $\{1\}$, $\{2\}$, and $\{1,2\}$
inverses with any given principal/annihilator ideals. As a consequence, we
obtain sufficient conditions for any right/left ideal of $\mathcal{R}$ to be a
principal or an annihilator ideal of an idempotent element of $\mathcal{R}$. We
then study some particular generalized inverses: Drazin and $(b,c)$ inverses,
and in rings with involution, $(e,f)$ Moore-Penrose, $e$-core, $f$-dual core,
$w$-core, $v$-dual core, right $w$-core, left $v$-dual core, and $(p,q)$
inverses.
