The problem of theodicy—why a benevolent G-d allows so much evil to exist in this world—has troubled thinkers from time immemorial.
The Talmud (Brachot 7a) relates that when Moshe asked G-d to “Make Your way known to me" (Shemot 33:13), he was asking G-d why, all too often, the righteous suffer and the wicked prosper. Compounding the problem is that the suffering of the righteous actually calls into question the Torah itself. The Torah promises reward and punishment based on our actions, with those who follow the mitzvot to be rewarded in this world. Yet hachush macheesh lechol roeh, we see with our very own eyes, that it is just not true. Thus, Rav Yaakov goes so far as to claim, “reward for mitzvot does not exist in this world” (Kiddushin 39b). Rather, all the rewards of the Torah are meant for the next world.
Rav Yaakov came to this view wondering how it could be that a child, requested by their father to chase away a mother bird and bring him the eggs, could be killed in the process. It is specifically regarding these two mitzvot, kivud av v’eim and shiluach hakan, that the Torah promises long life to those who fulfil them. When his rabbinic colleagues, unable to reconcile the verses of the Torah with such a scenario, suggested that such a case is inconceivable, the Gemara notes that Rav Yaakov actually witnessed this exact tragic scenario.
That left him with two choices. He could, the Gemara notes, follow in the path of Acher, and reject the Torah. Unwilling, unable and not wanting to do so, he put forth his radical claim that the rewards promised by the Torah are for the World to Come only. Rav Yosef, hearing this supposition, laconically noted that, “if only Acher would have interpreted the verse like Rav Yaakov, the son of my daughter, he would not have sinned.”
While we can appreciate why Rav Yaakov would reject the notion of earthly reward, his rabbinic colleagues were not willing to do so. They fully understood the danger of Rav Yaakov’s approach both theologically and exegetically. The pshat, the simple, plain meaning of the Torah—and our Sages note that a verse never departs from its pshat (Shabbat 63a)—is that there is reward in this world for mitzvot. And for those not well acquainted with the text of the Torah—a group that likely included the vast majority of the Jewish people—the idea that there is no reward for mitzvot is not something that would resonate. Few would be comforted by such an argument.
Hence, Rav Yaakov’s colleagues proposed a variety of ways to “square the circle”, allowing one to explain the sad story and yet maintain the simple reading of the Torah that there is reward in this world. Maybe he had negative thoughts, maybe he was thinking idolatrous thoughts, maybe he died on the way back from performing the mitzvah, maybe it was a faulty ladder. Maybe this, maybe that, but the Gemara rejects each of these suggestions, leaving—unsurprisingly—the issue of theodicy unsolved.
Yet the idea that one could be injured or even killed in the performance of a mitzvah greatly bothered the rabbis. Apparently rejecting the view of Rabbi Yaakov, they posited that "sheluchai mitzvah einam nizakin", those in the process of doing a mitzvah are not harmed. Yet they recognized that “in a place where harm is nearby”, this principle cannot be applied. “One does not rely on miracles.”
Our Sages thus ruled that “One is not required to place one’s hand into holes and crevices to search for chametz, due to the danger” (Pesachim 8a). The Gemara explains that seeing this rather unusual behavior, a non-Jewish neighbour might think his Jewish neighbour is involved in some sort of sorcery. As to the retort that those involved in a mitzvah are not harmed, the Gemara answers that “a place where danger lurks is different.”
The Gemara never explains exactly what the danger is. Presumably, we are afraid that the non-Jew will harm the Jew for acting in such a peculiar way. While that may, thankfully, seem farfetched to us, that may not have been the case where and when the authors of this teaching lived. And if it was farfetched even then, that just means that one must be concerned with even the most remote chance of danger and not rely on performing mitzvot to protect oneself.
Perhaps we can suggest that our Sages were not worried about physical danger. Rather, they were worried that such behaviour would cause others to see Judaism as a strange and superstitious religion. The Torah tells us that we are to observe mitzvot as “proof of your wisdom and discernment to other peoples, who on hearing of all these laws will say, ‘Surely, that great nation is a wise and discerning people’” (Devarim 4:6). If we are to be a light unto the nations, our practices must engender awe in others as they marvel at the beautiful way of life the Torah presents. Searching in holes and crevices for moldy bread crumbs was something that could cause ridicule, turning the mitzvah itself into something that, instead of offering protection from danger, would be “dangerous” itself.
Even if there is no danger, mitzvot can only offer protection if the mitzvah is done lishma, with total dedication and devoid of any ulterior motives.
This discussion of sheluchai mitzvah einam nizakin is immediately followed by a seemingly unrelated teaching. “Rabbi Avin bar Rav Adda said in the name of Rabbi Yitzchak: Why are the fruits of Ginnosar not in Jerusalem? So that the pilgrims would not say: If we had ascended only to eat the fruit of Ginnosar, it would have been sufficient for us. It would turn out that the ascent to Jerusalem would be shelo lishma, not for its own sake. Similarly. Rabbi Dostai, son of Rabbi Yannai said: Why are the hot springs of Tiberias not located in Jerusalem? So that the pilgrims would not say: If we had only ascended to bathe in the hot springs of Tiberias, it would have been sufficient for us. It would turn out that the ascent to Jerusalem would be not for its own sake” (Pesachim 8b).
Yet these teachings seem difficult to understand. As the Gemara soon teaches, “A person should always engage in Torah and mitzvot, even shelo lishma, not for their own sake, as from shelo lishma one comes to [do mitzvot] lishma, for their own sake” (Pesachim 50b). Our commentaries note that in the vast majority of cases—perhaps in all of them—the observance of mitzvot lishma can only happen after a period of shelo lishma. It is very difficult to be 100% properly motivated from the get-go. Would it not have been better for the “hot springs of Tiberias” to be situated in Jerusalem, serving as extra motivation to come to Jerusalem and encouraging the fulfillment of the mitzvah of aliyah leregel? Let them come for the baths; eventually they will come even if the baths are closed. If hot baths and delicious fruit are what it takes to get people to come to Jerusalem, those ought to be promoted. That is just plain good marketing.
However, placed in the context of our discussion, these teachings become clear. Whatever the application of sheluchai mitzvah einam nizakin, it can only come into play if one is doing the mitzvah for the mitzvah’s sake and no other reason. There is nothing wrong with enjoying some hot springs in addition to coming to the Temple. But don’t expect any special protection. That is reserved for those whose piety is such that they have only desires of the spirit. For the rest of us—might we say, all of us?—the mitzvah that offers the best protection is “v’nishmartem meod et nafshetocheichem, you shall guard yourselves very well” (Devarim 4:15).
 This is the phrase used by the Vilna Gaon (Orach Chaim 261) in rejecting the view of the Tosafists (and most medieval authorities) who claim that a day does not definitively end (or begin) until some 72 minutes after sunset. While this understanding is more faithful to the rabbinic texts, the Vilna Gaon noted that all one has to do is walk outside to see that it is pitch black well beforehand.
 I hope I am not being irreverent if I say these questions remind me of the riddle, “Who’s buried in Grant’s tomb?” If the hot springs of Tiberias were in Jerusalem, well, they would not be the hot springs of Tiberias.
 Hence, Rav Chaim of Volozhin explains the use of the word leolam, that one should “forever” perform mitzvot shelo lishma, as from lo lishma, one comes to observe them lishma.
 When one is cognizant of the fact that many Jews did not regularly (or ever) make the required pilgrimage to Jerusalem, the question becomes stronger.