At night, bats swoop through the air, snatching up hundreds of insects and other small animals. But during the day, they hardly move at all. Instead, bats pass the time hanging upside down from a secluded spot, such as the roof of a cave, the underside of a bridge or the inside of a hollowed-out tree.
There are a couple different reasons why bats roost this way. First of all, it puts them in an ideal position for takeoff. Unlike birds, bats can't launch themselves into the air from the ground. Their wings don't produce enough lift to take off from a dead stop, and their hind legs are so small and underdeveloped that they can't run to build up the necessary takeoff speed. Instead, they use their front claws to climb to a high spot, and then fall into flight. By sleeping upside down in a high location, they are all set to launch if they need to escape the roost.
Hanging upside down is also a great way to hide from danger. During the hours when most predators are active (particularly birds of prey), bats congregate where few animals would think to look and most can't reach. This allows them to disappear from the world until night comes again. There's also little competition for these roosting spots, as other flying animals don't have the ability to hang upside down.
Bats have a unique physiological adaptation that lets them hang around this way without exerting any energy. If you want to clench your fist around an object, you must contract several muscles in your arm, which are connected to your fingers by tendons. As one muscle contracts, it pulls a tendon, which pulls one of your fingers closed. A bat's talons close in the same way, except that their tendons are connected only to the upper body, not to a muscle. To hang upside down, a bat flies into position, pulls its claws open with other muscles and finds a surface to grip. To get the talons to grab hold of the surface, the bat simply lets its body relax. The weight of the upper body pulls down on the tendons connected to the talons, causing them to clench. The talon joints lock into position, and the bat's weight keeps them closed.
Consequently, the bat doesn't have to do anything to hang upside down. It only has to exert energy to release its grip, flexing muscles that pull its talons open. Since the talons remain closed when the bat is relaxed, a bat that dies while roosting will continue to hang upside down until something (another bat, for example) jostles it loose.