There are three steps you should follow if you want to achieve this effect: Step 1: Set the shutter to a longer exposure. Step 2: Compose the picture, focus and then shoot. Step 3: Zoom the lens in and out in between the times when the shutter opens and when it closes.
This may not work from the beginning, but you'll get it right with a lot of practice, and that's the fun part about photography. Here are a few tips that can get you better results in less time:
1. Setting the shutter speed - You should choose a the speed in such a way as to give you enough time to zoom the lens all the way in or out. There is no standard setting. There are some factors you should take into account whenever you take such a photo. These factors include the level of lighting available, the type of lens you have and the amount of movement (both of the subject and the camera). Again, experimenting with different speeds is very important as a different setting will give you another level of the zoom effect.
2. Aperture - Though not very important for the zoom effect, aperture can be a problem in overexposed situations when you set the shutter speed very low as it allows more light inside. You can cope with this by setting a larger aperture.
3. Zooming - In order to get nice and uniform motion lines in the photo you should be able to keep the zooming speed constant. Speeding up at one point and slowing down later will ruin the picture. Experimenting is again critical for success.
4. The use of lighting - Using lights in a certain way can have pretty interesting effects on the zoom effect. Below are two pictures taking at a stage performance with the stage being lighted in colorful bright lights while the rest was dark. The first photo is aimed to show the real situation, while the second uses the racking the lens effect. In the second photo, the photographer pressed the flash button just enough to catch the subjects on the foreground. In long exposure, he did manage to freeze just part of the picture (the audience and video crew) while creating a movement effect behind it (the stage performance) as well as around it (the infrared effect from a camera)
Hope you will find these tips useful. However, remember that the more you practice, the better you'll get. It's all about experimenting and playing with the camera.