This article is from the Table Tennis (Ping Pong) FAQ, by ttennis@bu.edu with numerous contributions by others.
3.15.1 After 5 points have been scored the receiving player or pair shall
become the serving player or pair and so on until the end of the game,
or until each player or pair has scored 20 points or until the
introduction of the expedite system.
3.15.2 In doubles,
3.15.2.1 the first server shall be the selected player of the pair having the
right to serve first and the first receiver shall be the appropriate
player of the opposing pair;
3.15.2.2 the second server shall be the player who was the first receiver and
the second receiver shall be the partner of the first server;
3.15.2.3 the third server shall be the partner of the first server and the third
receiver shall be the partner of the first receiver;
3.15.2.4 the fourth server shall be the partner of the first receiver and the
fourth receiver shall be the first server;
3.15.2.5 the fifth server shall be the player who was the first server and the
players shall thereafter serve in the same sequence until the end of
the game.
3.15.3 If both players or pairs have scored 20 points or if the expedite system
is in operation the sequence of serving and receiving shall be the same
but each player shall serve for only one point in turn until the end of
the game.
3.15.4 The player or pair who served first in a game shall receive first in
the immediately subsequent game of the match.
3.15.5 In each game of a doubles match after the first, the first server having
been chosen, the first receiver shall be the player who served to him
in the immediately preceding game.
3.15.6 In the last possible game of a doubles match the pair due next to receive
shall change the order of receiving when first either pair scores 10
points.
3.15.7 The player or pair starting at one end in a game shall start at the other
end in the immediately subsequent game of the match.
3.15.8 In the last possible game of a match the players shall change ends when
first either player or pair scores 10 points.
 
Continue to: