For this to work, you have to focus on your subject and move with them at the same speed while the shutter is open. Say your subject is moving from left to right. Press your shutter button down half way to focus and start panning to the right with your subject. Now press your shutter button down to take the picture while still following your subject. You will not be able to see them through the view finder while the shutter is open so that's why it is important to start panning with them before you take the picture to get your speed right. Another helpful tip is to keep panning with your subject after the shutter closes. It's like a follow through when swinging a golf club or baseball bat. You want to pan before, during, and after the exposure just like you want to swing through the ball.
Once you get this technique down you can apply it to all sorts of picture opportunities. One last thing to keep in mind when doing this is framing your subject so that they have somewhere to go in the picture. Again, if the subject is moving from left to right, frame them to the left side of the picture so there is more space on the right side. This will help the effect by showing they are moving to the right side of the picture.