Three Billy Goats Gruff
Like many short fairy tales for younger children, this story has resisted attempts to pin an obvious moral on it. It is based on the archetypes:
protagonist achieves heart's desire through guile
protagonist overcomes antagonist through guile and main strength
three brother tale
the monstrous gatekeeper
The heart's desire is the green grass on the other side, but don't be fooled. There isn't a "grass is always greener" Aesop afoot here. On the other side of the river the grass really is better, and this is confirmed once it is tasted. You can argue until you're blue in the face about the lesson here, there isn't one. In many traditional tales, a wish to be fed is fullfilled, and lends weight to the idea that reading about a feast helps to alleviate hunger (as well as making it worse for some people).
The tale makes very strong use of rhythm - as announced by the title. It is possible that "billy goats" were selected as heroes for the rhythmic quality of the phrase "three billy goats gruff". Peasants will remember that male goats, even brothers, will rarely tolerate one another. So we can assume that they "aren't really goats". This is where it becomes a classic "three brother tale" — any hero who sets out on a quest that has already claimed the lives of his two older brothers is absolutely guaranteed to succeed. Where TTBGG makes this more interesting is that the first two brothers both meet the danger with guile, passing it on in turn to a stronger older brother. In the classic three brother scenario, it is the youngest who succeeds, usually through guile or with the aid of magical helpers or talking cats.
In this case, the eldest brother doesn't even take the time to complete the repeated rhythmic mantra, but directly, and with no fuss, overcomes the troll by the most direct means available: butting him into the river.
There are lessons for writers and storytellers in this story, not just lessons for children. I have often wondered what Aesop would have made of it. He was a smart man, so he would probably have thrown in the towel.
The monstrous gatekeeper addresses the injustice of feudal europe that is, sadly, hardly less present today: that a few individuals have power over critical structures or resources. This is a story that teaches that those who haven't the strength to rebel should use subterfuge to escape control, while those who do have the strength should rise up in bloody insurrection. Okay, maybe that's a bit strong, but the trope is there.
Finally, this story contains an essential staple of the fairytale, that of structural and verbal repetition. Indeed it takes the verbal repetition to a point where the children not only feel it is acceptable, but necessary, to join in. Each goat is bigger, so his feet make a louder sound, so each time the (poor) troll has to shout his challenge louder, and the balance of the defiant sound (trip-trap, trip-trap of the goat's hooves) with the troll's challenge (who's that trip-trapping over my bridge) provides the children with an advance warning of what will happen in the end.
In terms of its influence, the most obvious place is Roger Hargreaves, who frequently uses the same devices in his stories, and frequently subverts narrative convention in the same way that this story does. In Mr Tickle, the eponymous character has arms so long he can reach across more than one page. Terry Pratchett is both consciously and unconsciously influenced by this story. I suspect its legacy is very great indeed, as it tells storytellers that you can make a good story by combining strong conventions with deliberately misused conventions. It also tells us that we can, and should, be subversive in what we teach even to the very young!