First thing's first, you need to find an appropriate pen. The ones which work best are the ones with a little bit of weight to them, but not too heavy. It can be rather difficult to learn with those varieties of pens which are bought for about ten cents each. If you are having trouble with spinning your pen, maybe it's the pen and not you.
Now--to set up your spin, place your thumb and your fore-finger close to the end of the pen (about an inch from one edge of the pen). Your Index finger should fall into place about half way down the pen. Setting up your pen properly is where everything begins!
Next you're ready for the spin. Take a deep breath, and slowly picture it in your mind. It helped me to move the pen with my other hand, and move the pen around my thumb a few times first. When you think you're ready, quickly flick the pen towards you with your index finger (towards you is important).
You didn't get it, did you? Spinning a pen takes a lot of practice. First you have to get just the right feeling for the flick, and then catching the pen is an entirely different matter. Don't be too ashamed if your first few pen spins end up spinning out of your hand onto the floor.
Keep practicing! I cannot stress this enough. If you can flick the pen around your finger in the first few tries you have a naturally gift! It generally takes days to perfect the technique, but once you do, you can show off for all your friends in the office or at school!