If a king will arise from the House of David who is learned in Torah and
observant of the mitzvot [the Torah's commandments], as prescribed by the
written law and the oral law, as David his ancestor was, and will compel all
of Israel to walk in [the way of the Torah] and reinforce the breaches [in
its observance]; and fight the wars of G-d, we may, with assurance, consider
him the Moshiach.
If he succeeds in the above, builds the Temple in its place, and gathers
the dispersed of Israel, he is definitely the Moshiach.
If he did not succeed to this degree or he 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.
G-d only caused him to arise in order 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."
The Rambam then continues by explaining why Judaism has rejected the claims of other religions that
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 L-rd. Since, he said, the required criteria
[as described in the preceding paragraphs] have not been met, all messianic claims to date have been proven false.
The full text is in the Rambam's Mishneh Torah, Sefer Shoftim, Hilchot Melachim U'Milchamoteihem, Chapter 11.
The Rambam's statement is probably the definitive rendering of the traditional Jewish view on the subject. Others believe that the Moshiach (Messiah) will usher in an age of miracles, and will come in a miraculous manner.