Given a prime \(p\) and some integer \(a\). If \(p \nmid a\) we can use Euler's theorem to say:
$$ (a, p) = 1 \implies a^{\phi(p)} ≡ 1 \mod p $$
By definition of prime \(p\), there is only one integer in it's complete residue system that is coprime to \(p\). In other words, the number of integers in it's reduced residue system is \( \phi(p) = p - 1 \):
$$ a^{p-1} ≡ 1 \mod p $$
This would also mean:
$$ a^p ≡ a \mod p $$
If \(p | a\), then \(a ≡ 0 \mod p\).