Straight out of the mlb rule book:
An INFIELD FLY is a fair fly ball (not including a line drive nor an attempted bunt) which can be caught by an infielder with ordinary effort, when first and second, orfirst, second and third bases are occupied, before two are out. The pitcher, catcher and any outfielder who stations himself in the infield on the play shall be considered infielders for the purpose of this rule.
When it seems apparent that a batted ball will be an Infield Fly, the umpire shall immediately declare "Infield Fly" for the benefit of the runners. If the ball is near thebaselines, the umpire shall declare "Infield Fly, if Fair."The ball is alive and runners may advance at the risk of the ball being caught, or retouch and advance after the ball is touched, the same as on any fly ball. If the hitbecomes a foul ball, it is treated the same as any foul.If a declared Infield Fly is allowed to fall untouched to the ground, and bounces foul before passing first or third base, it is a foul ball. If a declared Infield Fly fallsuntouched to the ground outside the baseline, and bounces fair before passing first or third base, it is an Infield Fly.
Rule 2.00 (Infield Fly) Comment: On the infield fly rule the umpire is to rule whether the ball could ordinarily have been handled by an infielder-not by some arbitrary limitation such as the grass, or the base lines. The umpire must rule also that a ball is an infield fly, even if handled by an outfielder, if, in the umpire's judgment, the ball could have been as easily handled by an infielder. Theinfield fly is in no sense to be considered an appeal play. The umpire's judgment must govern, and thedecision should be made immediately.
When an infield fly rule is called, runners may advance at their own risk. If on an infield fly rule, the infielder intentionally drops a fair ball, the ball remains in play despite the provisions of Rule 6.05(l). The infield fly rule takes precedence.