How does our yearning for Moshiach hasten his arrival?
The yearning for Moshiach in itself hastens his coming. This is clear from the verse, "G-d... will act for those who wait for Him." Or, as rendered in the Aramaic paraphrase of Onkelos, "...for those who hope and wait for Your Redemption."
How does one's yearning for Redemption hasten its coming?
To understand this, we need only to observe the comment of the sages on the Divine promise of the Redemption, "I will hasten it in its time." Now, is this verse promising that the Redemption will be hastened, or that it will come in its time? To resolve this paradox, the sages taught: If the Jewish people are worthy, the Redemption will be hastened, ahead of its preordained time. If they are found not worthy, it will come in its time.
Here lies the answer to our above question. When people yearn for the Redemption in earnest, they live worthier lives. By virtue of their endeavors, the Jewish people as a whole will increasingly be found worthy, and accordingly, the long-awaited Redemption will be brought forward.
Every day in the Amidah prayer, we recite the blessing "Speedily cause the scion of David Your servant to flourish, and increase his power for Your salvation, for we hope for Your salvation every day." Rabbi Chaim Yosef David Azulay offered a novel interpretation for this prayer. Even if the objection be raised that we are not worthy of Redemption, grant our request nevertheless, 'for we hope for Your salvation.' We have this hope, and by virtue of this hope, we deserve to be redeemed!"
(From Exile to Redemption, pp. 143-44. Likutei Sichos vol. VIII, p. 359. Chida)