The line at the front of the end zone is called the goal line. It is also referred to as the "plane," and it can be broken by crossing it. In order for a touchdown to count, the ball must break the plane of the goal line. If the ball is on the line, the plane has still been broken, and a touchdown is ruled.
Officials stand on the goal line to make sure the ball breaks the imaginary three-dimensional plane of the goal line. They are called line judges and they must judge the play live whether or not they think the ball crossed the line.
A coach may throw a challenge flag onto the field if they believe that a mistake has been made by an official. A challenge instigates a review of play with instant replay to determine whether or not the ball crossed the goal line.
As a referee, there are situations where this is too close to call. Instant replay is used by officials to review the play. The referees are able to watch the play from several different angles to best judge the ruling of the play. The camera angle that is most helpful when reviewing whether or not the play broke the plane is one right on the goal line.