Scout ants walk in random directions until they find food accidentally. When he comes back with food, other drones follow his scent trail. The repeated use of the trail makes it more and more defined, so more drones notice it (like how humans make trails in a forest accidentally over time)
From what I've read, it's just a numbers game. Other scouts will inevitably come across the main line or find other paths towards the food... and then whichever path is the most efficient will result in the most ants going back and forth between the nest and it, which will make others abandon the longer one.
Edit: Here's a great breakdown: http://mute-net.sourceforge.net/howAnts.shtml
LimeWire accessed the Gnutella network. Download a Gnutella client and you can still get in. Looks like Gtk-Gnutella is still maintained.
Jason Rohrer's MUTE isn't maintained anymore, but it receives an honorable mention because it was just so cool.
I mean the ants are able to navigate throughout their nest using pheromone trails and their memory. If they can find the chamber with the queen and find any other chamber, they will also be able to find and memorize where the entrance is. This is an interesting site on how ants find food, I suggest they use similar methods inside their nests. Through the combination of pheromone trails as well as olfactory and tactile cues they can navigate perfectly throughout their nests.
Although it's difficult to find out how they actually find the exit, because you would have to experiment on an enclosed nest. And if they can't find the entrance anymore, they can just dig a new one. :)