Review the definition of homomorphism. An endomorphism is a homomorphism that maps G into itself. Multiply the integers by 29, and you have an endomorphism from Z into Z. It also happens to be a monomorphism, a perfect copy of Z living inside itself.
An automorphism is an endomorphism, a monomorphism, and an epimorphism. In other words, a function f maps G onto itself, and is 1-1, and preserves the structure of G. Multiply the integers by -1 for an automorphism.
To illustrate, let's look at the automorphisms of the group Zn. This is a cyclic group, generated by 1, so once f(1) is defined, the entire group is mapped. The resulting map is an automorphism iff f(1) is coprime to n. There are φ(n) such automorphisms, including the trivial automorphism that maps 1 to 1. The integers have only two automorphisms, as 1 maps to ±1.
The set of automorphisms forms a group. Two functions are "multiplied" by applying the first, then the second. These functions are really permutations on the underlying set, that happen to commute with *. Applying permutations is associative, and the identity permutation is the identity automorphism, so we only need to prove that inverse automorphisms exist.
An automorphism f has an inverse permutation j; just move the elements back into position. What if we apply j first? Let z = j(x)*j(y). Now f(z) = f(j(x)*j(y)) = f(j(x))*f(j(y)) = x*y. Undo f, and get j(x*y). Thus j(x)*j(y) = j(x*y). Like f, j commutes with *, and is an automorphism. The automorphisms form a group under function composition.
Return to Zn, with its φ(n) automorphisms. If the first function maps 1 to u, and the second maps 1 to v, their composition maps 1 to uv. The group of automorphisms is Zn*, the elements coprime to n under modular multiplication. Click here for a complete characterization of these multiplicative groups.