The distressed, and distressing, behaviour of the pilot whales currently threatening to beach themselves in South Uist reflects the remarkable and highly complex nature of cetacean sociability. Pilot whales, like the other toothed whales (odontocetes) of their sub-order – which includes sperm whales, killer whales and dolphins – form social groups, unlike baleen whales (mysticetes, such as the blue whale, the fin whale and the humpback), which generally travel alone or in mother-calf pairs.

Toothed whales may travel in massive pods of hundreds, even thousands; I've seen pilot whales in huge numbers in the Bay of Biscay, the Azores and Cape Cod. Between their two species (the long-finned and the short-finned pilot whale) they can be found in almost every ocean. The combined population may number more than 1.5m. They are nomadic, as opposed to migratory in habit (unlike the mysticetes), principally going where their food source takes them; these are deep-diving cetaceans, often feeding on squid at depths of 200-500 metres. They are also obviously highly successful – and part of that success must be due to their socialisation, held together by bonds we still do not completely understand.

Photograph: Andrew Sutton

We know that they communicate with each other continually. Dolphins have been proven to use signature whistles with which they announce their presence in the group. Sperm whales and pilot whales almost certainly use this method, too – unique in the animal kingdom. They focus these sounds through the bio-acoustical oil contained in their distinctively rounded heads, known as melons – in fact, enlarged noses. The necropsy on the first whale to die in South Uist indicated an infection in this area of the whale's anatomy, which might have caused its disorientation – and also caused its fellow whales to follow it into shallow waters. Such strandings are sadly common, and occur around the world – even in the river Thames, where a pod of 20 pilot whales appeared in 1965.

The scenes of the whales in Scotland show typical behaviour. They are moving together, dependent on one another as a cohesive whole, but are composed of smaller family units of 10 to 20 whales. Genetic methods and observation, by scientists such as Hal Whitehead, of Dalhousie University, Nova Scotia, have proved that these are basically matriarchal, but with males staying with their mother's group all their lives. As a result, these units are permanent and incredibly loyal. Hence the behaviour of the endangered whales in South Uist where the second whale to die was also a female. Photographs showing the whales raising their heads above water displays behaviour known as "spy-hopping" – they are literally looking up and around them. This may look cute but in this situation, where the animals are far too close to shore, it is a sign of near panic.

Pilot whales are no strangers to Scottish waters. In fact, it was the Orkney scientist, Thomas Traill, who first observed and scientifically named the pilot whale, Globicephala melas, in 1809, as a result of his firsthand experience of the cetaceans – either alive, at sea, or stranded on Orcadian beaches. "This kind of dolphin sometimes appears in large herds off the Orkney, Shetland, and Feroe islands," noted Traill's friend and fellow scientist, William Scoresby. "The main body of the herd follows the leading whales, and from this property the animal is called in Shetland the ca'ing whale, and by Dr Traill the deductor."

It's because of their propensity to act in unison, following one another, that these whales – also known as "blackfish" – were hunted as they still are, controversially, in the Faroe Islands, by being driven into shallow bays and slaughtered. Humans have even adopted pilot whale behaviour for their own warlike ends. The warriors of the Ngāti Kahungunu, a Māori iwi tribe, donned black cloaks and lay on the beach to lure an enemy iwi who would believe they were beached pilot whales and a source of ready food.

More benevolent encounters between pilot whales and humans have been witnessed off Gibraltar and the Canary Islands. Pilots are, like many cetaceans, highly inquisitive, and divers report the animals will often make physical contact. This is not always a good idea. A now-infamous YouTube clip shows a female diver being dragged down by a pilot whale and nearly drowning. Far from being a "vicious attack", however, this whale was probably only playing, displaying the sociability of its species, which has brought them into such dangerous straits off the Scottish coast.