Why must the Jews go through so much pain until we get Mashiach? We are always told that Hashem loves us, so why doesn't he just send us Mashiach?
The basic, if somewhat oversimplified, answer is that our sins are holding backing the coming of Mashiach and are the cause for all our sufferings in exile. As we say in the Yom Tov Musaf prayer, "mipnei chataeinu galinu mei'artzeinu" - "for our sins we were exiled from our land".
On a more sophisticated level, the Chofetz Chaim, in his pamphlet titled Tzipisa L'Yeshuah, which deals with the belief in the coming of Mashiach, writes in chapter 2 that the previous exiles were shorter because in each case the following "redemption" was not complete. For example, the Egyptian exile was followed by the conquest of the land of Israel; a period that only lasted till the destruction of the first Temple. The Babylonian Exile only lasted 70 years, but the redemption which followed it was never truly complete. For most of the period of the second Temple the Jewish nation was under foreign rule, and even this ended after the destruction of the second Temple. The coming redemption, however, will encompass the entire world and will last for all time; it is therefore necessary for many processes to be completed before the current exile can be ended.