Chickens, like other birds, have special tendons and ligaments, so that when they curl their feet around a roost and fall asleep, the legs lock into place and they don't fall off. I've had a hen die of a broken neck when she fell asleep and slipped off of a shelf in the coop (since removed!) but...