I know that if $p$ prime and $p\nmid a$, then $a^{p-1}\equiv 1\pmod p$ and I know also that $a^{p}\equiv a \pmod p$ using the fact $a\equiv a \pmod p$ and multiplying the members.
What I couldn't understand is why in the Fermat little theorem we have $a^{p}\equiv a \pmod p$ for all integer $a$.
Following the comments of André Nicholas:
If $p\mid a$, then $a\equiv 0 \pmod p$, then multiplying $p$ times both sides we have $a^p\equiv 0 \pmod p$. Thus we have $a\equiv 0 \pmod p$ and $0\equiv a^p\pmod p$ by symmetry, then finally by transitivity:
$$a\equiv a^p \pmod p$$