"You shall be banished swiftly from the goodly Land that G-d gives you. You shall place these words ..." (Deuteronomy 11; 17 - 18). Rashi (based on Sifri 43) comments on this verse: "Even after you are exiled [from the Land of Israel] you should decorate yourselves with the Mitzvot, put on Tefillin, place a mezuzah on your doorposts etc. in order that they should not be new to you when you return [from your exile]. Similarly the prophet says "Set up signposts for yourselves" (Jeremiah 31; 20)."
The Vilna Gaon points out the apparent contradiction between this Midrash, and a Mishna. The Mishna (Kiddushin (36b)) states: "Any commandment which is dependent on the Land only applies in the Land of Israel, and any that is not dependent on the Land applies both in Israel and outside of Israel, with the exception of the Mitzvot of Orla1 and Kilayim2 [which apply also outside of Israel - Rashi]." The Talmud (ibid. 37a) explains further that the definition of a commandment which is dependent on the Land is one that is not an obligation on the ground, or on things which grow in the ground. Similarly one which is not dependent on the Land is one which is an obligation on the person themselves, such as keeping Shabbat, putting on Tefillin, not worshipping idols etc.
Why does the Midrash need to give the reason for performing the Mitzvot outside of Israel as in order that they should not be new to you when you return? Since this Midrash mentions those Mitzvot like Tefillin and mezuzah which are dependent on the person performing them, but not those which are dependent on the Land, surely the reason for keeping them is that they apply equally outside Israel as in Israel?
The Mishna L'Melech in his book Parshas D'rachim quotes the Rashba, who resolves this question. He explains that the Torah makes several references to the fact that G-d is giving us the Land of Israel in order that we should be able to keep the Torah (e.g. "You shall observe His decrees and His commandments so that you will prolong your days on the Land that G-d gives you..." (Deuteronomy 4; 40)). the Talmud which obligates Mitzvot outside Israel is only referring to such time as the majority of Jews are living in Israel. At such a time leaving Israel is not an exemption from the Mitzvot. However, once the majority of Jews live in exile one may have thought that there is a general exemption from all the Mitzvot, therefore the Midrash teaches us that we are still obligated, so that they should not seem foreign to us when we eventually return to Israel.
Rabbeinu Bachaya resolves this contradiction. He says that the Midrash teaches us that the essential performance of the Mitzvot is only possible in Israel. Even though we are equally obligated to perform the Mitzvot which are not dependent on the Land wherever we live, the effect is not the same as performing them in Israel.
Based on this explanation, we can understand the Talmud in Ketubot (110b): "A person should always try to live in the Land of Israel, even in a city which is mostly non-Jewish, rather than live outside the Land of Israel, even in a city which is mostly Jewish, because someone who dwells in the Land of Israel is like someone who has [a relationship with] G-d, but someone who dwells outside the Land of Israel is like someone who does not have [a relationship with] G-d." Though it is possible to be a good Jew anywhere in the world, and to live in a Jewish city with Jewish schools, restaurants and Synagogues, the value of the Mitzvot, and the connection with G-d is less than in the Land of Israel.
HaK'tav v'HaKabbalah explains the importance of performing Mitzvot outside of Israel, based on the analogy given in the Midrash. The Sifri likens it to a king who grew angry with his wife, and sent her away to her parent's house. The wife's father said to her "Make sure that you wear your jewellery, so that when you return to the palace you will not be unaccustomed to them." Similarly G-d says to the Jews, "You should decorate yourselves with the Mitzvot in order that they should not be new to you when you return." With this analogy the Midrash teaches us that through performing the Mitzvot we show that we have not despaired of returning to the palace, the Land of Israel. Similarly, by continuing to decorate ourselves with Mitzvot we show that our love for G-d has not diminished though we are far from Him at the moment.