Does the mishnah or the Talmud say that a righteous person can die for some one else, if so where in either of these books, does it say that.
Shalom. In time of war, we find throughout the Tanach that the Bible heroes were military heroes, and as such, often altruistically risked their lives to save others. Even though they usually came out alive, we know that a natural part of every war is that there are casualties, and some missions even know ahead of time that the warriors will definitely not survive. Nevertheless, one is clearly allowed to give his life to save the nation of Israel or even individual Jews in time of war (Minchat Chinuch, 425). However, it should be stressed that the idea is not to glorify death but to guarantee national life, and even this is only during war. Contrarily, in regular times, one is not allowed to give their life to save another’s (for who says the other’s blood is “redder” than yours?, Bava Metziah, 62a), but only to possibly endanger himself in order to definitely save someone else. For example, one is allowed, yet not obligated, to donate a kidney to others, if it will save your friend and for you, it just may sometime cause danger in the future (Or Same’ach). We do find in a midrash, as if it were, that Adam volunteered to give David 70 years of his life, explaining why Adam died at the age of 930 rather than 1,000, and David lived until the age of 70 (Yalkut Shimoni, Breishit 41). On the other hand, as you probably are aware, we do not learn halacha from midrashim, which are meant to teach ideas, philosophy, mysticism or the like, rather we learn the laws from the Talmud and halachic sources. How much more so, when parallel editions of that Midrash (Otzar HaMidrashim, p. 479) are significantly different, saying that G-d took those years from Adam, for halachically, Adam would not be allowed to shorten his life for the sake of David’s. With Love of Israel, Rav Ari Shvat (Chwat)