We are told why Moshe and Aharon passed away in the desert (Bamidbar 20:12), but we are not told why Miriam died.
According to Rashi (Bamidbar 1:49, 26:64), only the men who were counted in the primary census died in the desert. Does this not indicate that no women died in the desert? If that's the case, Miriam was the only one. Why?
[See here where it is suggested that Miriam died through no fault of her own, rather to teach us that death is beyond human understanding]