I just want to add some additional information to the answer of Ilmari.
As Ilmari has already described in his answer, when using RSA you work in the ring of integers ${\mathbb Z}/{\mathbb Z}_n$,
which is also called a residue class ring. This means that it consists of the set of residue classes $[i]$,
where the $i$'th class is defined as the set $\{a \in {\mathbb Z}, \exists k: a = k\cdot n + i\}$ or equivalently $\{a \in {\mathbb Z}: a \equiv i \pmod n\}$. Basically, the sets of
integers that have the same remainder when dividing them by $n$. Note that $i$ is clearly from the set $\{0,\ldots,n-1\}$, i.e., there are $n$ distinct equivalence classes in this ring.
It is quite easy to check that $a$ congruent to $b$ modulo $n$ (the relation is denoted as $\equiv$) for any $a,b\in {\mathbb Z}$ defines an equivalence relation on ${\mathbb Z}$, i.e.,
it's reflexive, symmetric and transitive, which gives the partitioning of ${\mathbb Z}$ into these distinct equivalence classes (residue classes).
Even more, the relation $\equiv$ on ${\mathbb Z}$, written as $a\equiv b \pmod n$, actually represents a congruence relation, i.e., an equivalence relation
which is compatible with the operations of the underlying algebraic structure.
In our specific case this means that for the ring of integers $({\mathbb Z},+,\cdot)$ and relation $\equiv$ (congruence modulo $n$)
it holds that for any: $a_1, a_2, b_1, b_2 \in {\mathbb Z}$ where $a_1,a_2$ are from the same class and $b_1,b_2$ are from the same class,
i.e., $a_1 \equiv a_2 \pmod n$ and $b_1 \equiv b_2 \pmod n$, it holds that:
- $a_1 + b_1 \equiv a_2 + b_2 \pmod n$
- $a_1 \cdot b_1 \equiv a_2 \cdot b_2 \pmod n$
This basically means that for any classes $i$ and $j$ we have that $[i] + [j] = [i+j]$ and $[i] \cdot [j] = [i\cdot j]$ and this in term means that it does
not matter which representative from one class we take when performing the respective operation (addition or multiplication). This gives us the the ring ${\mathbb Z}/{\mathbb Z}_n$ is the set of equivalence classes modulo $n$ with addition and multiplication on these equivalence classes.
When operating on the residue class ring ${\mathbb Z}/{\mathbb Z}_n$ as in RSA, however, we typically do not consider working with the residue classes (at least we do not write that down), but we choose a system of representatives for all $n$ residue classes.
Tis means that for every class $[i]$, we choose an integer as representative. Since it is most meaningful, we therefore choose
the least nonnegative system of representatives, namely the set $\{0,\ldots,n-1\}$ and identify the respective
residue classes with its representatives, i.e., consider ${\mathbb Z}/{\mathbb Z}_n$ simply to be the set $\{0,\ldots,n-1\}$.
Consequently, we always reduce modulo $n$ to obtain the respective
representative of the class, although we could work with any representative of the respective class.
As Ilmari says, if one reduces intermediate results or not does not make a difference in theory (but it makes a difference from an efficiency point of view in implementations). Nevertheless, the final result is always considered to be an element in the set $\{0,\ldots,n-1\}$ and thus reduced modulo $n$.