I was reading this post and struck me that one of the reasons why Jesus is not considered to be the Messiah in Judaism is because he died (for example see the bottom of this answer, or this one or this one). I can't quite get the connection. Cannot the Moshiach die? This is, would it live forever? I think there is also a restriction that people after Moses cannot live longer than 120 (see this question). How are the two things reconciled?
The idea is that if someone died or was killed before fulfilling his messianic mission, such as was the case by Bar Kochba, who was thought to be the mashiach until this happened, then he is at most like any other righteous king of Israel, but not the mashiach. This is spelled out in the Rambam, Hilchot Melachim, Chapter 11, as follows:
ח ואם יעמוד מלך מבית דויד הוגה בתורה ועוסק במצוות כדויד אביו, כפי תורה שבכתב ושבעל פה, ויכוף כל ישראל לילך בה ולחזק בדקה, ויילחם מלחמות ה'--הרי זה בחזקת שהוא משיח: אם עשה והצליח, וניצח כל האומות שסביביו, ובנה מקדש במקומו, וקיבץ נדחי ישראל--הרי זה משיח בוודאי.
ט ואם לא הצליח עד כה, או נהרג--בידוע שאינו זה שהבטיחה עליו תורה, והרי הוא ככל מלכי בית דויד השלמים הכשרים שמתו. ולא העמידו הקדוש ברוך הוא אלא לנסות בו רבים, שנאמר "ומן המשכילים ייכשלו, לצרוף בהן ולברר וללבן--עד עת קץ: כי עוד, למועד" (ראה דנייאל יא,לה).
י אף ישוע הנוצרי שדימה שיהיה משיח, ונהרג בבית דין--כבר נתנבא בו דנייאל, שנאמר "ובני פריצי עמך, יינשאו להעמיד חזון--ונכשלו" (דנייאל יא,יד). וכי יש מכשול גדול מזה: שכל הנביאים דיברו שהמשיח גואל ישראל ומושיעם, ומקבץ נדחיהם ומחזק מצוותן; וזה גרם לאבד ישראל בחרב, ולפזר שאריתם ולהשפילם, ולהחליף התורה, ולהטעות רוב העולם לעבוד אלוה מבלעדי ה'.
Or, in English, courtesy of Chabad:
If a king will arise from the House of David who diligently contemplates the Torah and observes its mitzvot as prescribed by the Written Law and the Oral Law as David, his ancestor, will compel all of Israel to walk in (the way of the Torah) and rectify the breaches in its observance, and fight the wars of God, we may, with assurance, consider him Mashiach.
If he succeeds in the above, builds the Temple in its place, and gathers the dispersed of Israel, he is definitely the Mashiach.
He will then improve the entire world, motivating all the nations to serve God together, as Tzephaniah 3:9 states: 'I will transform the peoples to a purer language that they all will call upon the name of God and serve Him with one purpose.'
If he did not succeed to this degree or was killed, he surely is not the redeemer promised by the Torah. Rather, he should be considered as all the other proper and complete kings of the Davidic dynasty who died. God caused him to arise only to test the many, as Daniel 11:35 states: 'And some of the wise men will stumble, to try them, to refine, and to clarify until the appointed time, because the set time is in the future.'
Jesus of Nazareth who aspired to be the Mashiach and was executed by the court was also alluded to in Daniel's prophecies, as ibid. 11:14 states: 'The vulgar among your people shall exalt themselves in an attempt to fulfill the vision, but they shall stumble.'
Can there be a greater stumbling block than Christianity? All the prophets spoke of Mashiach as the redeemer of Israel and their savior who would gather their dispersed and strengthen their observance of the mitzvot. In contrast, Christianity caused the Jews to be slain by the sword, their remnants to be scattered and humbled, the Torah to be altered, and the majority of the world to err and serve a god other than the Lord.
According to Rambam in pirush hamishnayos to Sanhedrin, Moshiach will die after he fulfills his job. See the first source here
The main benefit of that time (the Messianic Age) will be that they (Israel) shall have rest from the subjugation of the nations who have prevented us from performing the commandments. Wisdom will be increased as it says “The world shall be filled with knowledge (of HaShem as the water fills the ocean)” (Isaiah 11:9) Wars will cease as it says, “And nation will not lift up sword against other nations.” (Isaiah 2:4) There will be in those days great perfection and we shall merit the life of the world to come. The Messiah will then die and his son will rule in his place and so his grandson.