This result is called Fermat's Little Theorem. I suppose the reason that it holds is because every number less than p is coprime to p and so there are no zero divisors. So every element has an inverse, but there is not enough space for it not to be of this form.

For an example, try working mod 5 (this is small enough to work with).

.

Alternatively, plug the following code into maple,

p:=7;

for n from 1 to (p-1) do

a:=p^{n-1}:

print(a, a mod p):

od:

and change the number p to be any prime.

There actually exists a very beautiful proof of this result, which can be found on

wikipedia. (Actually, this page contains many beautiful proofs of the theorem. If you really want to understand the theorem, read through as many of these proofs as you have the knowledge to grasp.)