Man could achieve happiness by submitting to Allah and obeying Him and by being content with His decree and predestination.
Many claim that everything does not have an essential meaning and, consequently, we are free to find a meaning to ourselves for the sake of attaining a satisfactory life. The denial of the purpose behind our existence is, in fact, a self-deceit. It is as if we are telling ourselves: "Let us assume or pretend that we have a goal in this life", like the children who pretend while playing that they are doctors, nurses, or parents. We can never achieve happiness unless we know our purpose in life.
If a person was placed in a luxurious train against his will and he found himself riding in the first class, a fancy and comfortable experience and something extremely luxurious, will he be happy during this journey without getting answers for questions that are on his mind like: How did I ride this train? What is the purpose behind this journey? Where is it heading? How could he be happy if such questions remain unanswered? Even if he starts enjoying all the luxuries that are at his disposal, he will never achieve true and genuine happiness. Could a delicious meal in this journey be sufficient to make him forget these questions? This kind of happiness is fake and temporary and can only be achieved by deliberately neglecting the process of finding an answer to such vital questions. It is something like the fake ecstasy resulting from the consumption of intoxicants that leads one to his doom. Therefore, true happiness could only be attained when man finds answers to these existential questions.