Usually sometime between the fifth and seventh innings, the starting pitcher will become tired, and/or his pitching will not be as solid as it was earlier in the game. In other scenarios, the pitcher's place in the lineup was replaced with a pinch hitter, and once replaced with a pinch hitter, a player is not allowed to re-enter the game. In situations where the manager feels the starting pitcher should or needs to be taken out of the game, he will replace him with a relief pitcher/reliever.
Rarely just one reliever is used in a game. Relief pitchers tend to only pitch one or a few innings, and sometimes they do not even pitch an entire inning. Relievers tend to have specialized skills, such as throwing very fast pitches or throwing a specific kind of pitch. They also do not have as much stamina as starters, since they do not typically throw nearly as many innings as starters. Therefore, relievers are often replaced when they get tired, or when another pitcher's special skill is needed.
Relief pitchers are a relatively new phenomenon in baseball; they began picking up prominence and significance in Major League Baseball around the 1970's and 1980's. Before then, it was common for starting pitchers to pitch most, if not all, of the game. The rise in relievers was partly due to the fact that batters gradually became better at hitting fast pitches, so pitchers had to learn to increase the speed of their pitches. Since throwing faster pitches is more tiring, starting pitchers had less stamina to last the entire game, and relievers' roles grew.
A closer is a special type of reliever; he is often the team's best relief pitcher. The closer is specifically in charge of getting the final outs of the game.
He usually only pitches one inning -- the last inning -- and only if his team is in the lead. This is to preserve his strength and energy; managers don't want their closers tiring themselves out on a game the team might lose, when it is better strategy to use the closer to solidify a probable win.
The setup pitcher is the relief pitcher who sets up, or pitches directly before, the closer so he can successfully end the game.
The setup pitcher is often the team's second best relief pitcher, and he usually pitches the eighth inning, ensuring that his team's lead is kept so the closer can finish the game off. Unlike the closer, the setup pitcher is commonly used in games that are tied or that the team is losing.
Left-handed specialists, also called lefty specialists, are another type of relief pitcher. They are left-handed pitchers who specialize in throwing to left-handed batters or weak right-handed batters (often switch hitters who are naturally left-handed).
Since it is harder for batters to hit pitches thrown by a pitcher with the same dominant hand, lefty specialists are useful in putting these batters out. Lefty specialists often only pitch to one or two batters, in specific situations where a left-handed batter must be put out.