An animal has many reasons to behave more like a ‘wallflower’ vs. a ‘social butterfly’. Some of the more universal reasons to lean to one behavior more than the other would be 1) habitat, 2) predators or 3) availability of food.
For instance, river dolphins (pictured right) typically are solitaire animals because their habitat is smaller than that of the bottlenose dolphins that live in the open ocean. Bottlenose dolphins are highly social animals. Living in a group works to their benefit in the open ocean. A group can be more aware of predators that are nearby and they are able to work together to gather food. Food is rather tough to gather if you are just one mid-size animal in the expansive sea.
Image (c) botswanagallery.org.