Why do flamingos stand on one leg?

Flamingos might be highly recognisable, but there are competing theories about one of their distinctive characteristics - why they stand on one leg

Why do flamingos stand on one leg?

Photo: ic-cdn.flipboard.com