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. 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.
Impending rule changes that will go into effect at the start of the 2020 season
In an effort to reduce the number of pitching changes and, in turn, cut down the average time per game, MLB will institute a rule change beginning in 2020 that requires pitchers to either face a minimum of three batters in an appearance or pitch to the end of a half-inning, with exceptions for injuries and illnesses.