The worker ants will stop following the path and will start their search for more food. The other species of ants, like army ants, are completely blind and live in the colonies by the strength of thousands or millions. They carry out the foraging raid in an organized manner by using the chemical communication system which has chemical pheromones.
When you look closely, you can see the way, how they communicate and maintain the line of their traveling. You would have also had an experience of breaking the line of ants and then observing the ants getting confused for some time.
These ants reconnect in their way shortly due to their chemical trail pheromones; thus allowing the followers to resume the walking. Generally, ants alter their way when they come against an obstacle and choose the shortest route to reach their food source.
So, from next time whenever you locate a single ant running on the floor, you know what is it looking for!