Why do Animals have Tails?

Is most of the animals, tail plays important role of balancing. Some animals use the tail to make grip on tress like monkey family. Tail is usually found on animals which live on trees or in trees.