Teams are permitted to substitute players any time the ball is dead. The manager must immediately notify the umpire of the switch and substitutes must bat in the replaced player's batting-order position. Once removed, players are not permitted to return to the game in any capacity. Types of substitutions include pinch-hitting, pinch-running, a pitching change and a defensive replacement.
Barring injury or illness, the starting pitcher must pitch until at least one batter reaches base or is put out before being substituted. Any substitute pitcher must pitch until at least one batter reaches base or is put out, or the offensive team is put out in some other manner.
A double-switch refers to the act of substituting two players at once. The tactic is typically used in the National League to bring in a new pitcher when the pitcher's spot in the batting order is due up in the next half-inning. Rather than performing a straight one-for-one swap of pitcher for pitcher, a team subs the new pitcher into the batting-order spot of a non-pitcher and subs another non-pitcher into the removed pitcher's batting-order spot. That way, the team can avoid having the pitcher come to bat in the next half-inning without needing to use additional substitutions for a pinch-hitter and then another pitcher.
Watch: Kirk Gibson enters Game 1 of the 1988 World Series as a pinch-hitter and hits a walk-off homer.