The foul lines and foul poles are used to demarcate fair territory and, thus, determine what constitutes a fair ball.
Any batted ball that first contacts a fielder while the ball is in fair territory is considered fair. If not touched by a fielder, any batted ball that first contacts the field in fair territory beyond first or third base -- with the foul lines and foul poles counting as fair territory -- is considered fair. Batted balls that first contact the field between home plate and first or third base are considered fair if they subsequently bounce over or directly contact either base, or otherwise pass either base while in fair territory. They are also considered fair if they settle in fair territory between home plate and first or third base, including instances in which they bounce off home plate.
Batted balls that directly strike either foul pole on the fly, or leave the park on a fly to the right of the left-field foul pole and to the left of the right-field foul pole are considered home runs.