The irony is that we mortals do not have much choice in this regard. We can just wish and pray.
Anyone will wish to have a painless sudden death. They would rather have it after all their other wishes fulfilled.
Our religious texts and legends have examples of a five year old boy (Dhruva)getting Moksha, and a ninety year old man(Melpathur Narayana Bhattathiri) praying in front of the deity and seeking why he was not given liberation even after so many years of human suffering. At that very instant when he prostrated before the deity he attained Moksha.
Birth and death are still hidden to humans. Once these two are revealed to humans, he will throw the belief of God and will consider himself as God.
However our wisdom texts teach us to do good, think good, speak good and to immerse in good activities of helping others and be god to all and do our duty always without thinking of rewards.