  For every square matrix $A$ over a field $\mathbb{K}$, we have the equality
$\mathrm{rank}(A) + \mathrm{rank}(I-A) = \mathrm{rank}(I) +
\mathrm{rank}(A-A^2)$ where $I$ denotes the identity matrix with the same
dimensions as $A$. In this article, we start a program to systematically
characterize and generalize such rank identities with a view towards
applications to operator algebras. We initiate the study of so-called ranked
rings (unital rings with a `rank-system'), the main examples of interest being
finite von Neumann algebras, Murray-von Neumann algebras, and von Neumann
rank-rings. In our framework, a field $\mathbb{K}$ may be viewed as a ranked
ring with a $\mathbb{Z}^+$-valued rank-system consisting of the usual rank
functions on $M_n(\mathbb{K})$ (for $n \in \mathbb{N})$ and serves as the
motivating example. We show that a finite von Neumann algebra $\mathscr{R}$
with center $\mathscr{C}$ (and the corresponding Murray-von Neumann algebra
$\mathscr{R}_{\textrm{aff}}$) may be endowed with a $\mathscr{C}^{+}$-valued
rank-system, considering $\mathscr{C}^{+}$ as a commutative monoid with respect
to operator addition. We give an algorithm to generate rank identities in
ranked $\mathbb{K}$-algebras via the polynomial function calculus, and in
ranked complex Banach algebras via the holomorphic function calculus. As an
illustrative application, using these abstract rank identities we show that the
sum of finitely many idempotents $e_1, \ldots, e_m$ in a finite von Neumann
algebra is an idempotent if and only if they are mutually orthogonal, that is,
$e_i e_j = \delta_{ij} e_i$ for $1 \le i, j \le m$. In contrast, this does not
hold in general in the ring of bounded operators on an infinite-dimensional
complex Hilbert space.
