If you're a backyard chicken keeper, you know that chickens go to sleep at dusk and wake up at dawn. In the wild, they'd seek high spots like tree branches to roost out of reach from predators. It's a survival instinct that has carried over even in the days of modern coops.
Chickens will usually make their way back to the roost on their own at first sign of dusk, so it's important that you provide them with a sturdy roost that they can use. You can use a branch, a plank, or even a wooden dowel as long as it's at least 2 inches wide. The wider the roost, the more comfortable your chickens will be. A roosting bar is also ideal as it keeps chicken feet flat and doesn't allow them to wrap their toes around the roost. This prevents frostbite in the winter and protects their toes from mice or rats that like to nibble on chicken toes as they sleep.
If you have a problem with one or more of your flock not going to their roost at night, it could be because they're being bullied by higher ups in the pecking order. Adding more roosts, increasing the coop size, or rehoming the bully should solve the problem. Other reasons a chicken may not want to roost include being hungry or having an injury that needs rest.