If we want to know if $n$ is prime, we can do the Fermat primality test:
if $a^{n-1}\not\equiv 1 \mod n$, then $n$ is not prime.
Now I often find that we choose therefore $a\in\{2,\ldots, n-2\}$. Why not $a=n-1$? In Wikipedia, I found that for $a=n-1$ the congruence always holds. Why?
If $n$ is odd (usually, this is assumed) and $a=n-1$, then we have $$(n-1)^{n-1}\equiv (-1)^{n-1}=1\mod n;$$ hence the criterion is satisfied whenever $n$ is odd.