What is the connection between the current episode and the well?
Rashi: When the two mountains reverted to their original locations, Hashem sent the well into the valley to bring up the blood, the bones and the limbs of the dead men and to carry them round the camp; Yisrael saw and sang Shirah.
Ramban: The Pasuk, which continues from Pasuk 13, is telling us that, after they traveled from the other side of Arnon without entering it, they circumvented the town Be'eirah. 1
Seforno: Refer to 21:15:2:2. From there, the stormy waters flowed down to the valley where the well was, to a spot that was much lower than the location of Yisrael, and when the well then accompanied them to the other side of Arnon, to the point from where the streams of the River Arnon flowed down to Mo'av, they sang Shirah on the great miracle (of the water defying the laws of nature and flowing upwards). 2
Ramban: Which they named after the miracle that took place there (Refer to 20:13:2:2), even though it is not listed as such in Parshas Mas'ei. And since it mentions the well, it sings its praises.