Understanding Shift Registers

Google "Sparkfun Inventor's Guide", look at Circuit 5 (CIRC-5) and compare with Circuit 2. It makes it quite clear and you can also download the commented code.