I have heard of sages being able to kill themselves with meditation. How do they do this?
Many yogis have claimed to be able to do this - the scientific evidence is not convincing.
In a controlled study, it was found this was not based on meditative control, but on holding the breath and considerable tensing of the muscles in the abdomen and thorax. This resulted in reduced blood flow, but did not stop the heart. One subject was able to slow his heart for a maximum of 3 seconds using this method.
Theravada Buddhist Answer.
Samatha meditation is designed to focus the mind, to cultivate the Jhana states, thereby preparing the mind for the insight-portion of the Buddha's path.
Vipassana meditation is designed to allow the mind to cultivate a deep and liberating understanding of conditioned reality. Vipassana meditation is the only meditation type that can completely eradicate the 3 layered defilements, ie. the deepest layer of latent tendencies (anusaya).
With that in mind, meditation cannot kill you but it can "kill" (cut off the latent tendencies at the root) the three root defilements.
Look up Phowa, Mahasamadhi, Parinirvana. If a monk has practiced enough, they will reach a point in spiritual development where they can just drop the body at will, permanently. Explained in a very simplified way, they do this by severing the attachment to the body, though the specific methods used may vary between traditions.
As mentioned above with phowa. The 6 yogas of naropa has a method to "transfer the consciousness" i'e wilfully kill yourself. If you have seen the tibetan buddhist monks who put kusha grass in their heads from a gap they have made in their crown plates, this is part of the practice. I do not know the methods as it seems this has never been written in text, unless anyone here has a textual guide to it (which I would like to see)
Allegedly some of the Buddha's disciples would attain final extinguishment whilst self-cremating(?) and it is an extinguishment of life-force.
I've read that Ananda raised himself into the air through his supernormal powers and let his body be consumed by the fire element. https://www.accesstoinsight.org/lib/authors/hecker/wheel273.html#section-10 (last paragraph)
We read about similar meditations in Vinaya, in particular the story of Ven. Sagata
The naga (living in the fire building) saw that Ven. Sagata had entered and, on seeing him, was upset, disgruntled, and emitted smoke. Ven. Sagata emitted smoke. The naga, unable to bear his anger, blazed up. Ven. Sagata, entering the fire element, blazed up. Then Ven. Sagata, having consumed the naga's fire with his own fire, left for Bhaddavatika. https://www.nku.edu/~kenneyr/Buddhism/lib/modern/bmc/ch8-6.html