I've been hearing about events like this my whole life and it's always kind of heartbreaking. I wonder if they will ever figure these mass suicide events out. "As many as 145 pilot whales have died after a mass stranding in Mason Bay on Stewart Island. A hiker reportedly spotted the whales on Saturday and notified Department of Conservation staff at 10.30pm. There were two pods stranded at the southern end of Mason Bay, approximately 2km apart. DoC Rakiura operations manager Ren Leppens said half of the whales had already died by the time they were found and due to the condition of the remaining whales and the remote, difficult to access location, the decision was made to euthanise the remainder." https://www.nzherald.co.nz/nz/news/article.cfm?c_id=1&objectid=12166302
As cetaceans are very intelligent mammals we cannot really know what happens. Personally I find it likely an environmental trigger (Sound/Chemical/temperature...etc…) is at play because the entire pod is effected.
These beaching events have been recorded since the days of sailing ships and before that in history when indigenous populations considered them a gift from the gods.