The bones in birds' legs are of nearly equal length and the hinges are opposite like an accordion. This has two advantages: They can lower themselves straight down to sit on their eggs without tipping over and they can retract their legs to a nearly flat position in flight.
To illustrate this I've highlighted the legs in red and numbered the joints:
- From the body to joint #1 is the thigh (femur)
- Joint #1 to #2 is the shin (tibiotarsus) and calf (fibula)
- Joint #2 to #3 is the foot (tarsometatarsus)
- Joint #3 to the end are the toes.
On peregrines it's rare to see all those segments. Their legs are much longer than we think!
The blue arrows show how birds fold their legs when they fly. In step (a) the thigh and shin fold up flat to the body and are hidden in the body feathers. In step (b) the foot and toes can do several things:
- They can extend straight backwards as shown by arrow (b),
- They can hang down in a slightly open position,
- Or they can retract up to the body just as the thigh and shin were retracted.
When you see only a peregrine's yellow toes in flight it's because his feet (which we call "legs") are extended backward and covered by his body feathers.
Aeronautical engineers learned from birds. Watch a jet take off and you'll see it retract its "legs" under its wings.
(bird skeleton by W. Ramsay Smith and J S Newell, 1889, via Wikimedia Commons, altered to illustrate the leg. Click on the image to see the original.)