The Ohr Hachaim asks, what is the purpose of the word וְהָיָה? Why not just start with עֵקֶב תִּשְמְעוּן – when you shall listen? The word עֵקֶב also seems unnecessary, why not just write אִּם תִּשְמְעוּן? Although the Chachamim use the word עֵקֶב to tell us that this refers to the mitzvos that others tread on with their heels, that is the Derash, not the simple explanation of the possuk.
The Medrash says that the word וְהָיָה denotes happiness. The Torah is telling us when the appropriate time for happiness will arrive. When a person guards and does everything that Hashem has taught us, he is ready for true happiness. When, however, he is missing something and has not become a complete servant of Hashem, he has not reached the level of happiness and Shlomo Hamelech says about him (Koheles 2:2) וּלְשִּמְחָה מַה זֹּה עֹּשָה – what does happiness do for a person?
The possuk now reads, וְהָיָה – you will be completely happy, עֵקֶב תִּשְמְעוּן – when you shall listen to all of Hashem’s mitzvos. Until then, nobody has a reason to be happy. This underscores the importance of listening to Hashem's mitzvos, as it is the path to true happiness and fulfillment.
Another similar point the Ohr Hachaim explains is that a person cannot trust himself to stay a Tzadik until the end of his life. This is why a person cannot be happy until the end of a life of listening to Hashem.
Another explanation given by the Ohr Hachaim about this happiness is that Torah must be learned with happiness. The listening a person has to show Hashem has to be done with happiness. In addition, the possuk says (Tehillim 19:9) פִּקּוּדֵי ה' יְשָרִּ ים מְשַמְחֵי לֵב - Hashem's precepts are upright, making the heart joyful. Listening to Hashem makes a person happy, and learning Torah causes happiness.
The Zohar writes that there is no happiness in front of Hashem like when Klal Yisroel toils in learning Torah. The word וְהָיָה denotes happiness. The supreme happiness in the world, where Hashem is happy about everything, is עֵקֶב תִּשְמְעוּן – when you shall listen to all of Hashem’s mitzvos, when you shall be learning Torah. The word used is עֵקֶב, which literally means ‘heel.’ A person who learns Torah should act like a heel, walking slowly and humbly, and consequently will be able to understand and listen to the Torah he is taught.
He adds an explanation for the extra נון at the end of the word תִּשְמְעוּן that it refers to the fifty ‘gates of understanding’ that include the secrets of Torah.
When a person lives with absolute humility and simplicity, like a heel, he will understand the secrets of the Torah. This will be on a level that will uplift his fulfillment of the mitzvos of the Torah, and will protect him from any aveira. The possuk continues וּשְמַרְ תֶם וַעֲשִּיתֶם אֹּתָם - and you shall guard and perform them.
