I know that ants have some sense of direction, but what is the physiology behind this sense?
Well, first off, they have eyes, so there's that.
However, a lot of what ants wish to achieve can be done through a combination of a random walk and chemical trails.
When ants are exploring their surroundings, they are essentially wandering about without much in terms of a sense of purpose; laying down a chemical signature as they go.
When they find something interesting, like food, they use their own chemical trail to backtrack, laying down a new chemical trail indicating the nature of what they have discovered, making a kind of smell-road from the hill to the point of interest.
Any ants that subsequently come across this trail follow it, and subsequently join in transporting the food back to the hill.
An interesting implication of this behaviour is the antmill, wherein an ant will lose their trail, and revert to following a nearby ant. If the ant they follow are following them to begin with, this can lead to a spiral of ants that can reach miles in diameter, consisting of confused ants walking until they die from exhaustion.