According to the Tibetan custom, in the event of someone dying, a member of the family of the dying person would request a Lama to perform the “phowa” ceremony (i.e. Transference of consciousness at the time of death.)
The Lama performing the ceremony would have himself mastered the art of phowa (transferring the consciousness at the time of death) after having previously been initiated into the practice and meditation given only to Tulkus (Incarnates) and retreated to the hills to carry out the practice which he would continue night and day until the signs he was told to watch for (at the time his initiation) appear.
He would then leave his retreat equipped now to instruct monks, nuns and lay people in the practice. He would however, continue to perform the practice at least once a month. When he becomes aware of the signs of his approaching death (signs he was taught to recognize during his retreat period), he would meet the eventuality with a great calmness and equanimity.
via The Teaching of Phowa: Transference of Consciousness at the Time of Death – Dharmaweb.