Proof. Proof of Fermat’s Little Theorem [01EL]
The first property is precisely the many dropout lemma, which states (0+i)^p \equiv 0^p+i \equiv i \mod p.
For the second part, we assume that p\nmid i and must show that i^{p-1}\equiv 1 \mod p. We consider the following sequence of equivalences, where the first statement holds by the first part of the theorem:
\begin {aligned} i^p\equiv i \mod p &\Longleftrightarrow p\mid {\mathopen {}\left (i^p - i\right )\mathclose {}} \\ &\Longleftrightarrow p\mid i\cdot {\mathopen {}\left (i^{p-1}-1\right )\mathclose {}} \end {aligned}By Euclid’s Thoerem, it therefore follows that either p\mid i or p\mid {\mathopen {}\left (i^{p-1}-1\right )\mathclose {}}. The former is ruled out by assumption, and the latter is equivalent by definition to i^{p-1}\equiv 1 \mod p.