In baseball, a sacrifice fly is a batted ball that satisfies four criteria:
It is called a "sacrifice" fly because the batter presumably intends to allow a teammate to score a run, while sacrificing their own ability to do so. Sacrifice flies are traditionally recorded in box scores with the designation "SF".
As addressed within Rule 10.08(d) of the Official Baseball Rules, a sacrifice fly is not counted as a turn at bat for the batter, though the batter is credited with a run batted in.
The purpose of not counting a sacrifice fly as an at-bat is to avoid penalizing hitters for a successful action. The sacrifice fly is one of two instances in baseball where a batter is not charged with a time at bat after putting a ball in play; the other is the sacrifice hit (also known as a sacrifice bunt). But, while a sacrifice fly doesn't affect a player's batting average, it counts as a plate appearance, thus lowering his on-base percentage, and a player on a hitting streak will have the hit streak end if he has no official at-bats but has a sacrifice fly. The reason for this is that the sacrifice fly, unlike the sacrifice bunt, is not considered a tactical maneuver (players don't try to hit a fly ball to advance a runner). Unlike a sacrifice bunt, which may be scored if a runner advances from any base to any base, a sacrifice fly is only credited if a runner scores on the play. Therefore, when a runner on first or second base tags on a fly ball and advances no further than third base, no sacrifice is given and the batter is charged with an at-bat. Note that, although rarely occurring, if a runner tags and advances from second base (or, theoretically, from first base) all the way to home and scores (without an intervening error) the batter is credited with a sacrifice fly.
The sacrifice fly is credited even if another runner is put out on appeal for failing to tag up, so long as a run scores prior to the third out. In the case of a fly ball dropped for an error, the sacrifice fly is only credited if the official scorer believes the run would have scored had the ball been caught.
On any fly ball, a runner can attempt to advance bases right as a fielder touches the ball. If the fielder bobbles the ball, the runner may still tag up, even before the fielder has full control of the ball (before the fielder is credited with a putout). The rule works this way because a smart fielder can theoretically purposely bobble the ball and run with it at the same time towards the infield and only completely catch it when he is within a good throwing distance to home plate. As addressed in the Official Baseball Rules, this was put into the baseball rulebook so it prevented these fielders from intentionally bobbling the ball.