Everyone is searching for happiness. Even in the tradition of the American founding fathers, all men are entitled to "the pursuit of happiness". Exactly what constitutes happiness? To some it would mean money; to others, kovod. To others a yacht; and yet to others, a cigarette.
The possuk in Koheles states (6:7) that whatever man acquires will neither satisfy him nor make him happy. The Medrash explains by way of a parable that if a farmer marries a princess, he will never be able to satisfy her. Even if he buys her items which would be considered "luxurious" for a farmer - the most fancy dungarees with the most colorful patches, and a ton of straw to sleep on - it will not make her happy, since she is used to royal clothing and the most beautiful furniture. Similarly, Jewish souls come mitachas kissai hakavod ("from below the throne of Hashem"), and are used to being close to the shechina. All the money, yachts, and cigarettes in the world will not bring a Jewish soul satisfaction.
From Rosh Chodesh Elul until the end of Sukkos it is customary in many communities to recite the twenty-seventh perek of Tehillim at the conclusion of the tefillos. In that perek, Dovid Hamelech points out that he only has one real request of Hashem: "to be able to stay in the House of Hashem for the rest of his life." The one and only thing that people are searching for is happiness, and Dovid Hamelech defines happiness as being "in the presence of Hashem." The possuk tells us ( Divrei Hayamim I 16:27) that in the presence of Hashem there is always joy. The Talmud comments (Chagiga 5B) based on this possuk that there is no sadness when one is in the presence of Hashem. Jewish neshamos are used to being close to the Shechina (before they were born), and the only way for them to attain happiness and comfort is to return back to that state.
The Torah often writes, that we should "rejoice in the presence on Hashem." (See, for example, Parashas Re'eh 16:11.) The Talmud understands that the state of being "in the presence of Hashem" causes one to "rejoice". Because the Kohen Gadol must always be in the Beis Hamikdosh ("in the presence of Hashem"), it follows that he has a mitzvah of simcha all year long. The rest of Klal Yisrael have a mitzvah of simcha on the sholosh regalim because at those times we all have an obligation to visit the Beis Hamikdash to enter into the state of "lifnei Hashem". (See Talmud Moed Katan 14B and Nefesh Harav pg. 314)
There is a dispute among the tanaaim as to whether there is a mitzvah of simcha on Rosh Hashana and Yom Kippur. (See Moed Katan 19A.) The accepted opinion is that there is such a mitzvah. Rav Soloveitchik explained that the prophets compare sins to a mechitza which separates the person from Hashem. Only when one does teshuva can one return to his original state of lifnei Hashem. Because on Yom Hakippurim there is a special mitzvah of teshuva (over and above the mitzvah of teshuva of all year around), and an obligation to come lifnei Hashem, we have a special mitzvah of simcha on Yom Hakippurim.
The Talmud points out that because the purpose of blowing the shofar on Rosh Hashana is "to bring before Hashem the remembrance of the Jewish people", (i.e. blowing of the shofar constitutes a form of tefillah), therefore it is considered as if we are in the Kodesh Hakodoshim, in the presence of Hashem (Rosh Hashana 26A). This state in turn engenders the mitzvah of simcha.
When Kayin killed his brother Hevel, he realized on his own that he would be punished. He assumed that his punishment would be that he would no longer be permitted to be "in the presence of Hashem." And indeed, the Chumash continues to state that that was his punishment- he had to leave "the presence of Hashem" (Beraishis 3:14 and 3: 16). What does this mean? How can one possibly leave the presence of Hashem, who is omnipresent and omniscient!? The Ramban (parashas Beraishis) explains that "to be in the presence of Hashem" means that one has the ability to daven and has the right to offer Korbanos, and it was these rights that kayin was now denied.
When the serpent was punished for having caused Chava to sin and eat from the etz hada'as, the Torah (Beraishis 3:14) records that part of his punishment was that from now on he should eat sand and dust. The Medrash there comments that when Hakadosh Boruch Hu punishes, He doesn't utterly destroy the sinner, but rather gives him a lighter punishment which is not that horrible; although the serpent will no longer eat delicious foods, and whatever he will eat will always taste like sand, still there is a positive side to this punishment, that he will never have to worry about food. Sand is available all over. From now on, the serpent will never have a da'agas haparnassah.
At first glance, the comment of the Medrash seems very strange. It would appear that for the serpent, his avaira paid off. How can it be "that the sinner is being rewarded"?! A famous explanation was offered by one of the great Chassidic Rebbes, Reb Itzele Surker. Because the serpent would never b e lacking anything, he would have no right to pray. Tefillah is only permitted when one perceives that he is lacking some of his needs. By giving the serpent his parnossah, for the rest of his life, Hashem was actually punishing him, just as Kayin was punished that he could never again be allowed to pray.
The Talmud (Berachos 8A) points out that since the destruction of the Bais Hamikdash, the only way to enter into the presence of Hakadosh Boruch Hu is by learning Torah. We believe that the Torah is a description of Hashem's essence, and when one engages in Torah study, he gets a better understanding of what G-d is all about and thereby becomes closer to Him (see the introduction to my most recent sefer "Ginas Egoz".) "When one learns Torah at night, the shechina will be there in front of him." (Tamid, end of fourth perek)
Happiness can be attained. We all have to opportunity and the privilege to daven and to learn. "I rejoice when they tell me, ‘let us go to the home of Hashem.'" (Tehillim 122:1.) It's all up to us!