There are two places where the Torah teaches us that the death of tzaddikim atones. One is found in Parshas Chukas where the death of Miriam is discussed immediately following the laws of the Parah Adumah, which purifies the impure. The other case is the description of the death of Aharon Hakohein's sons, which precedes the laws of Yom Kippur. Each of these tzaddikim taught us different ways to connect with Hashem throughout their lives. The life that Miriam led, and the be'er (well) that she endowed, is symbolic of the bond between Hashem and Bnei Yisrael that is quiet, simple, and yet incredibly powerful.