Bhagwad Geeta and all the Vedic literatures suggest us to come out of the cycle of birth and death. One who escapes this cycle attains The Supreme. Death is said to be an examination for everybody. It is a test whose date is not announced but is certain to take place. Bhagwad Geeta 8.5 to 8.15 gives certain guidelines to pass this examination.

(An ideal way of leaving the body: Bhishma Pitamah Meditating on Lord Krishna. He was fortunate that Lord Krishna was also present there.)

Bg 8.5 — And whoever, at the end of his life, quits his body remembering Me alone at once attains My nature. Of this there is no doubt.
Bg 8.6 — Whatever state of being one remembers when he quits his body, O son of Kuntī, that state he will attain without fail.

The state of mind at the time of quilting the body decides our (soul’s) next destination.
 Lord explains TWO methods of attaining the supreme. One method is for those who follow the personal (sagun) conception of God and the other who follow the impersonal (nirgun) conception.  Both of them are yogis.  

(According to a famous story Ajamil who was a sinful person remembered God at the time of death. The gods servents then drove away the servents of Yamraj who had come to take his soul)

Bg 8.7 — Therefore, Arjuna, you should always think of Me and at the same time carry out your prescribed duty of fighting. With your activities dedicated to Me and your mind and intelligence fixed on Me, you will attain Me without doubt.
(Jatayu leaving body fighting for Lord Ram)
Bg 8.8 — He who meditates on Me as the Supreme Personality of God, his mind constantly engaged in remembering Me, undeviated from the path, he, O Pārtha, is sure to reach Me.
Bg 8.9 — One should meditate upon the Supreme Person as the one who knows everything, as He who is the oldest, who is the controller, who is smaller than the smallest, who is the maintainer of everything, who is beyond all material conception, who is inconceivable, and who is always a person. He is luminous like the sun, and He is transcendental, beyond this material nature.


A 'Rajyogi' in Meditation
Bg 8.10 — One who, at the time of death, fixes his life air between the eyebrows and, by the strength of yoga, with an undeviating mind, engages himself in remembering the Supreme, will certainly attain to the Supreme.
Bg 8.11 — Persons who are learned in the Vedas, who utter oṁ-kāra, and who are great sages in the renounced order enter into Brahman. Desiring such perfection, one practices celibacy. I shall now briefly explain to you this process by which one may attain salvation.
Bg 8.12 — The yogic situation is that of detachment from all sensual engagements. Closing all the doors of the senses and fixing the mind on the heart and the life air at the top of the head, one establishes himself in yoga.
Bg 8.13 — After being situated in this yoga practice and vibrating the sacred syllable oṁ, the supreme combination of letters, if one thinks of the Supreme Person and quits his body, he will certainly reach the spiritual planets.

(A meditative posture)
(A meditative posture)

(Meditating on Super-soul near heart)

Bg 8.14 — For one who always remembers Me without deviation, I am easy to obtain, O son of Pṛthā, because of his constant engagement in me.

Bg 8.15 — After attaining Me, the great souls, who are yogīs, never return to this temporary world, which is full of miseries, because they have attained the highest perfection.

(A meditative posture)
* The Bhakti yogis reach the Vaikunth Planets or the abode of God in the spiritual sky, while the impersonalists mearge inthe 'Brahm Jyoti'. Both are said to be ideal situation and equivalent.