The following is taken from torah.org.
"The Great Redemption"
Exile: Ch. 5
First off, we’ve always been taught that our people *will* in fact be redeemed -- but under one of two different circumstances: either as a consequence of our having repented ... or simply because the time had come despite our hesitations, and what must be done will be done. We wanted to point that out from the first because many of us lose heart from time to time and wonder if we’ll ever be redeemed. But know that we surely will; for geulah is our destiny, and it’s a major factor in G-d’s plans for us and the world.
Now let’s lay out the process step by step. The first phenomenon to set it off will be “The War of Gog and 'M’gog”.
The prophet Ezekiel depicted it as an awesome time in the future when “Gog would come against the land of Israel” and when “there’ll be a great shaking in the land .... And all the fish of the sea, the birds in the sky, the beasts in the wild, the creeping things moving about the earth, and all people upon the face of the earth will tremble at My presence.” But a lot will precede that. “All the mountains will be cast down ... all the steep places will fall, and every single wall will drop to the ground.” But G-d warns us, though, that He “will call for a sword against (Gog) ... and every man’s sword will be against his brother” (38:18-21).