Ethan Siegel in Starts With A Bang!:
The long legs and long necks work in tandem, and it’s easy to see why evolution would favor these traits in flamingos: the longer their legs and necks are, the deeper the waters they can reliably feed in. If shallow-water food becomes scarce, it’s the long-legged-and-necked flamingos that survive.
But what’s the deal with the standing on one leg? Flamingos spend a lot of their time in the water, and whenever they’re there and not actively feeding, you can find them standing on just one leg, something that they even sometimes do when they’re on dry land.
Why on Earth would it be advantageous for a flamingo to stand on one leg instead of two?
Because physics, that’s why!
And it’s physics that anyone who’s ever been in the pool on a hot summer’s day will understand all too well.
More here.