When a ball collides with a surface such as the court or the strings of the racquet, the force by that surface on the ball can be separated into two parts, called components. In this analysis, let's consider the ball colliding with the racquet. The perpendicular component of the force on the ball (by the racquet) is the component of the force perpendicular to the surface of the racquet. The parallel component is the component of the force parallel to the racquet. This parallel component is what we call friction, and it is the frictional component that is solely responsible for giving the ball spin.
I will apply this general idea to the specific case of a serve. Let's assume that the player tosses the ball vertically and strikes the ball when the ball is at its peak and has zero velocity. Suppose that after the ball leaves the racquet, it has a velocity vf that is horizontal. On a serve like this, the racquet is generally angled downward when it strikes the ball as shown in Fig 1.
Figure 1: A racquet striking a ball during a serve.
Because the velocity of the ball before hitting the racquet, was zero, then the force on the ball by the racquet in this case is in the same direction of the velocity of the ball when leaving the racquet. I can now draw each of the components mentioned earlier, the force perpendicular to the racquet and the force parallel to the racquet which is friction. The force by the racquet and its components are shown in Fig. 2. It is the frictional force by the racquet on the ball that gives the tennis ball its spin.
Figure 2: A force on a ball during a serve.
So the frictional force gives the tennis ball spin. But will it be topspin, backspin, sidespin, or some combination? It depends on the line of action of the force. In Fig 3, I show just the force by the racquet and the frictional component with the picture zoomed in for clarity. The dot is the center of the ball. The line through the force vector is called the line of action. If this line of action passes above the center of the ball, then the frictional force causes topspin (which is counterclockwise in Fig. 3). As an aside, note that if the line of action goes through the center of the ball, then the ball will not spin at all.
Figure 3: The line of action and moment arm causing topspin.
An inexperienced player sometimes hits a serve as shown in Fig. 4 where the racquet is tilted upward.
Figure 4: An inexperienced serve. If hit hard, it'll be a service fault.
Again, suppose that the ball was struck when it was momentarily at rest and leaves the racquet horizontally. In this case, the line of action passes below the center of the ball as shown in Fig. 5, so the frictional force causes backspin (which is clockwise in this view).
Figure 5: The line of action and moment arm causing backspin.
Professional players want topspin on their serves so that while in flight, the air pushes downward on the ball causing it to land within the service box. However they also want sidespin on the ball so that when the ball bounces, friction by the court on the ball will cause it to bounce either away from the opponent or into the opponent's body, making it harder to hit in either case. As a result, they hit the ball above the center of the ball and to the side (left or right) of the center of the ball.
To illustrate this, first look at Fig 6. This is a side view of a 3-D image of the tennis ball, similar to Fig. 3, showing the force on the ball by the racquet.
Figure 6: A side view of the tennis ball showing it will have topspin.
Now I'm going to rotate the 3-D image so that you can see the ball from the perspective of the tennis player who is serving. Fig 7 shows the ball rotated so that the force vector is pointed away from the tennis player. In this view, you can see that the force by the racquet on the ball is to the left and above the center of mass. As a result, the ball has both topspin and sidespin, as it spins clockwise around the +y axis. When this ball passes over the net and bounces, it will spin to the right, as viewed by the server.
Figure 7: 3-D view from the server's perspective showing that the ball will have both topspin and sidespin. After hitting the court, it will bounce to the right, as seen by the server.
After this type of serve, the racquet's surface that struck the ball must face away from the server (and down). For a right-handed player, this serve is called a kicker because the ball "kicks" to the right when it bounces, as viewed by the server. In this picture of Roger Federer, you can tell that he served a kicker by the fact that his racquet faces away from him and his wrist and elbow are facing downward toward the court.
Figure 8: Roger Federer serving a kicker. (http://tennis.topbuzz.com/tennis-pics/d/925-3/roger+federer+serve+follow+through.jpg)
Suppose that a right-handed server wants to hit a slice so that the ball spins counterclockwise around the +y axis and bounces to the left as viewed by the server. In this case she should hit above and to the right of the center of the ball. Fig 8 shows the force on the ball in this case.
So now that you know how the angle of the racquet affects the spin of the tennis ball. Here's a quiz for you. For each of these images, predict whether the ball will have mostly pure topspin, pure backspin, or a combination of topspin and sidespin. If it is a combination, predict whether it is a "slice" or a "kicker." The answers can be found at end.
Figure 10: Kei Nishikori (http://mediaassets.kitsapsun.com/photo/2014/09/03/2014_US_Open_Tennis__WABRE_webfeeds_9_1409780583595_7713166_ver1.0_640_480.jpg)
Figure 11: Sabine Lisicki who is the current world record holder for the fastest serve in women's tennis. (http://espn.go.com/photo/2014/0827/ten_g_lisicki11_800x450.jpg)
Figure 12: Venus Williams. (http://mediaassets.kitsapsun.com/photo/2014/08/29/2014_US_Open_Tennis__WABRE_webfeeds_31_1409348545760_7620937_ver1.0_640_480.jpg)
Now that you know the physics required to give a tennis ball spin, you are ready to compete...in the U.S. Physics Olympiad. To compete in tennis, you'll probably need about 10,000 hours of practice. Compared with playing professional tennis, physics probably looks easy.
Answers: Figure 10 is backspin. Figure 11 is a kicker. Figure 12 is topspin.