According to Purusharthas (objectives of human life), the four objectives are Dharma, Artha, Kama, Moksha. Kama includes desire and Moksha requires someone not to have desire. How can they co-exist?
Kama and Moksha coexist in the Self (Atman) not in the human mind. That is to say they are part of Ishwara's divine opulence or divine glory (Satkirti). Attempts to reconcile both of them through the unrealized mind will lead to confusion and is best avoided.
Kama (BG 10.28):
prajanaś cāsmi kandarpaḥ
prajanaḥ — the cause for begetting children; ca — and; asmi — I am; kandarpaḥ — Cupid
Of causes for procreation I am Kandarpa, the god of love.
Moksha (SB 11.16.24):
yogānām — among the eight stages of yoga practice (aṣṭāṅga); ātma-saṁrodhaḥ — the ultimate stage, samādhi, in which the soul is completely separated from illusion;
Among the eight progressive states of yoga I am the final stage, samādhi, in which the soul is completely separated from illusion.
Kama and moksha do not coexist. They are meant for different types of people.
Vyasa said, ‘One that is a Brahmacharin, one that leads a life of domesticity, one that is a forest recluse, and one that leads a life of (religious) mendicancy, all reach the same high end by duly observing the duties of their respective modes of life. Or, if one and the same person, freed from desire and aversion, practises (one after another) all these four modes of life according to the ordinances that have been laid down, he is certainly fitted (by such contact) to understand Brahma. The four modes of life constitute a ladder or flight of steps. That flight is attached to Brahma. By ascending that flight one succeeds in reaching the region of Brahma.
Mahabharata Santi Parva Section CCXLII
Kama is meant for those who live lives of domesticity, i.e., householders. Moksha is the goal of sannyasis.
Human activity springs from Fears and Desires .Behind every Action(Karma), there is a motive of acquiring the results of Action (Karmaphala).An employee works with the hope of getting a Salary , at the end of a Month or Week or Day.A Student works with the hope of getting a Degree.
The results we want , in return of our Actions , may be of Physical Pleasure (Kama),Economic Benefits(Artha) or/and Wisdom and Elightenment(Dharma).
Finally , we come to understand that we are like Remote Controlled Robots, carrying out the Will of an Invisible Super Power---(Nimitta Matram).
""Ishwara: , sarbabhutanam ,hriddeshe:rjuna tishthati ;Bhramayan sarba bhutani,yantrarudhani Mayaya"---GITA
With this realisation, we lose the motive for action , also the fear of Future.
This is called Mokshya, liberation from all Human Psychological Bondages .
No fear of Present or Future or the Universe,--Nothing to Desire , in the Present or Future or from the Universe.
The concept of Karma is based on body. When the soul (aatma or jiva) obtains a body he starts doing karma knowingly or unknowingly. As the body is created by nature, the effect of different gunas (Sattva, Rajas and Tamas) make us do the karma.
If the sattva guna is at its prime, it leads us to spiritual way, makes us do good things. When rajo guna increases, the human tends to achieve more "bhog" or becomes materialistic and when tamas guna affects us we get into bad habits.
This is how our soul tends to work when it is in a body (human or other). But when the soul obtains Moksha it means we are no longer obligated to do karma. We don't have a body, only thing we have is peace.
In Hindi: Aatma Jyoti Svarup hai. Meaning: Soul is light and Paramatma (God) is Aanand Svarup (full of joy).
And when we reach that state as God, nothing will exist, there's only aanand.
So the moment we realize we are not the body but the Aatma, the moment we set ourselves above the law of nature and obtain the connection with the Supreme soul (God), that is Moksha.