Since you included evolution in your topics, I assume that you are also interested in how birds got their current leg anatomy (as shown in the other answers). Remember all birds are descendants of theropod dinosaurs, or actually still are theropod dinosaurs? read more
Actually, birds' "knees" (the point in the leg at which there is a backwards bend) is actually the ankle, whereas the knees are near the top of the leg, usually covered by feathers. read more
Here’s a shock for some people: birds’ knees bend the same way as human knees. The reason why it’s confusing is because we don’t see their knees. Instead, that joint in a bird’s leg which kind of looks like a knee (except it bends forwards) would more accurately be represented by our human ankles. read more