user6921: How do I do "contemplation of death" meditation? And is it dangerous?
Because I read it might cause someone to commit suicide, so how do I make sure I won't reach that situation? And how exactly should I do this meditation - and for how long each time - and how many times each day?

user7751: West is obsessed with thoughts and thinking process. Contemplation implies thinking in West. Contemplation about death does not mean imagining death or deep thinking about it. It is a tool to see things objectively that this world of yours is about to be finished sooner or later. It is a way to create an urgency to meditate and find out if death is the ultimate thing or not. It is also a way to make you relaxed and therefore prepare you for meditation. If you are going to die what is point of stressing yourself out for trivialities? 

user-1: Mindfulness of death is described in the Maranassati sutta (AN 6.20) which urges a disciple to get rid of unwholesome mental states by reflecting that one's own death can come at any time soon:

"There is the case where a monk, as day departs and night returns, reflects: 'Many are the [possible] causes of my death. A snake might bite me, a scorpion might sting me, a centipede might bite me. That would be how my death would come about. That would be an obstruction for me. Stumbling, I might fall; my food, digested, might trouble me; my bile might be provoked, my phlegm... piercing wind forces [in the body] might be provoked. That would be how my death would come about. That would be an obstruction for me.' Then the monk should investigate: 'Are there any evil, unskillful mental qualities unabandoned by me that would be an obstruction for me were I to die in the night?' If, on reflecting, he realizes that there are evil, unskillful mental qualities unabandoned by him that would be an obstruction for him were he to die in the night, then he should put forth extra desire, effort, diligence, endeavor, undivided mindfulness, & alertness for the abandoning of those very same evil, unskillful qualities.


When you mentioned suicide though, what you may be referring to instead is "contemplation on foulness/unattractiveness of the body", rather than "mindfulness of death". Contemplation on foulness is performed to abandon lust, promoting disenchantment with regard to forms (AN 9.1) -- so that's when it's useful to do it, for as long as lust is present. In the Satipatthana Sutta (MN 10), in the section on mindfulness of body, we read:

"Or again, as if he were to see a corpse cast away in a charnel ground, picked at by crows, vultures, & hawks, by dogs, hyenas, & various other creatures... a skeleton smeared with flesh & blood, connected with tendons... a fleshless skeleton smeared with blood, connected with tendons... a skeleton without flesh or blood, connected with tendons... bones detached from their tendons, scattered in all directions — here a hand bone, there a foot bone, here a shin bone, there a thigh bone, here a hip bone, there a back bone, here a rib, there a breast bone, here a shoulder bone, there a neck bone, here a jaw bone, there a tooth, here a skull... the bones whitened, somewhat like the color of shells... piled up, more than a year old... decomposed into a powder: He applies it to this very body, 'This body, too: Such is its nature, such is its future, such its unavoidable fate.'

... i.e. one of the techniques to "contemplate foulness" is to see the body dead and coming apart.
Some monasteries in Thailand have skeletons in display which can be an aid for such kind of meditation. But one can perform this meditation without a decomposing body:

iii. "And what, Ananda, is contemplation of foulness? Herein, Ananda, a monk contemplates this body upward from the soles of the feet, downward from the top of the hair, enclosed in skin, as being full of many impurities. In this body there are head-hairs, body-hairs, nails, teeth, skin, flesh, sinews, bones, marrow, kidneys, heart, liver, pleura, spleen, lungs, intestines, intestinal tract, stomach, feces, bile, phlegm, pus, blood, sweat, fat, tears, grease, saliva, nasal mucous, synovium (oil lubricating the joints), and urine. Thus he dwells contemplating foulness in this body. This, Ananda, is called contemplation of foulness.
-- AN 10.60

The likely reason you were told it may lead to suicide is because one sutta documents how a group of monks performed suicide after doing this practice (SN 54.9 ).
If one is mentally healthy (e.g. does not have suicide inclinations) and one is mindfull of bodhipakkhiyādhammā (e.g. one is able to direct his mind to joy, tranquility and equanimity), than I don't see danger in it.
Other than that, there was a US zen monk in recent times who, allegedly, was jogging and saw a dead corpse with a bullet wound in the head, thereafter deciding to come back to meditate over the corpse. As it so happens, he got in trouble with the police. So, don't do that.

user295: 
How to do "contemplation of death" meditation ? 

With each and every in and out breath reflect: "life is impermanent, but death is certain, hence will attend to what need to be done without delay."


“But how, bhikshu, do you cultivate the mindfulness of death?”
“Here, bhante, I do it thus:
'Indeed, should I live just the time it takes to breathe in and then out, to breathe out and then in,
    I would wisely attend to the Blessed One’s teaching, much indeed would be done by me!'
Thus, bhante, I cultivate the mindfulness of death.”


Source: (Aṭṭhaka) Maraṇa,sati Sutta 1 and also similar passage is in: (Chakka) Maraṇa,sati Sutta 1
A more detailed outline of the pratice is covered in: Maraṇa Sati Kathā by Piya Tan

and is it dangerous ?

Not if you pratice it correctly. Even crossing the road the wrong way will have dangers so does meditation. Key to do it the right way as with any other endeavor.
The intention of this pratice is to create urgency and eliminate procrastination as time is running out and what can be done within a lifetime ends with death. (Also see section How do you banish laziness?) Instead if you are developing a phobia or fear of death or some attraction to death or romanticizing with the concept of death or developing sorrow towards your pending death or of loved ones, then you are doing it wrong.

Cause i read it might cause someone to suicide - so how do i make sure i won't reach that situation ? and how exactly should i do this meditation - ...

As far as I know repulsive meditation has resulted in suicides, but not sure on contemplation of death. These are 2 separate practices. The purpose of repulsive meditation is to counteract the perception of beauty in the form and shape of oneself and others and developing lust and taking pleasure and delight in such formations. If you are developing aversion towards the body one oneself as unclean or the perceived lack of beauty then you are doing it wrong.
Both these practices do also reinforce the perception of impermanence, more particularly impermanence of life as well as our corporal body.

... and for how long each time - ...

I think a few minutes will do or as much as to keep you motivated to attend to what need to be done without procrastination.
Also an occasional reminder on the need of urgency as time is running out during the day may be helpful.

... and how many times each day ?

(Aṭṭhaka) Maraṇa,sati Sutta 2 and (Chakka) Maraṇa,sati Sutta 2 mentions you should do it 2 times at least when the day has ended and when the night has ended. You contemplate some mishap can happen your life can end in the next part of the day hence be attentive to what needs to be done without fail.
Also see my answer to: Is contemplation of death auto-suggestion?

6921: <p>How do I do "contemplation of death" meditation? And is it dangerous?</p>

<p>Because I read it might cause someone to commit suicide, so how do I make sure I won't reach that situation? And how exactly should I do this meditation - and for how long each time - and how many times each day?</p>
 7751: <p>West is obsessed with thoughts and thinking process. Contemplation implies thinking in West. Contemplation about death does not mean imagining death or deep thinking about it. It is a tool to see things objectively that this world of yours is about to be finished sooner or later. It is a way to create an urgency to meditate and find out if death is the ultimate thing or not. It is also a way to make you relaxed and therefore prepare you for meditation. If you are going to die what is point of stressing yourself out for trivialities? </p>
 -1: <p>Mindfulness of death is described in the Maranassati sutta (<a href="http://www.accesstoinsight.org/tipitaka/an/an06/an06.020.than.html" rel="nofollow">AN 6.20</a>) which urges a disciple to get rid of unwholesome mental states by reflecting that one's own death can come at any time soon:</p>

<blockquote>
  <p>"There is the case where a monk, as day departs and night returns, reflects: 'Many are the [possible] causes of my death. A snake might bite me, a scorpion might sting me, a centipede might bite me. That would be how my death would come about. That would be an obstruction for me. Stumbling, I might fall; my food, digested, might trouble me; my bile might be provoked, my phlegm... piercing wind forces [in the body] might be provoked. That would be how my death would come about. That would be an obstruction for me.' Then the monk should investigate: 'Are there any evil, unskillful mental qualities unabandoned by me that would be an obstruction for me were I to die in the night?' If, on reflecting, he realizes that there are evil, unskillful mental qualities unabandoned by him that would be an obstruction for him were he to die in the night, then he should put forth extra desire, effort, diligence, endeavor, undivided mindfulness, &amp; alertness for the abandoning of those very same evil, unskillful qualities.</p>
</blockquote>

<hr>

<p>When you mentioned suicide though, what you may be referring to instead is "contemplation on foulness/unattractiveness of the body", rather than "mindfulness of death". Contemplation on foulness is performed to abandon lust, promoting disenchantment with regard to forms (<a href="http://www.accesstoinsight.org/tipitaka/an/an09/an09.001.than.html" rel="nofollow">AN 9.1</a>) -- so that's when it's useful to do it, for as long as lust is present. In the Satipatthana Sutta (<a href="http://www.accesstoinsight.org/tipitaka/mn/mn.010.than.html" rel="nofollow">MN 10</a>), in the section on mindfulness of body, we read:</p>

<blockquote>
  <p>"Or again, as if he were to see a corpse cast away in a charnel ground, picked at by crows, vultures, &amp; hawks, by dogs, hyenas, &amp; various other creatures... a skeleton smeared with flesh &amp; blood, connected with tendons... a fleshless skeleton smeared with blood, connected with tendons... a skeleton without flesh or blood, connected with tendons... bones detached from their tendons, scattered in all directions — here a hand bone, there a foot bone, here a shin bone, there a thigh bone, here a hip bone, there a back bone, here a rib, there a breast bone, here a shoulder bone, there a neck bone, here a jaw bone, there a tooth, here a skull... the bones whitened, somewhat like the color of shells... piled up, more than a year old... decomposed into a powder: He applies it to this very body, 'This body, too: Such is its nature, such is its future, such its unavoidable fate.'</p>
</blockquote>

<p>... i.e. one of the techniques to "contemplate foulness" is to see the body dead and coming apart.</p>

<p>Some monasteries in Thailand have skeletons in display which can be an aid for such kind of meditation. But one can perform this meditation without a decomposing body:</p>

<blockquote>
  <p>iii. "And what, Ananda, is contemplation of foulness? Herein, Ananda, a monk contemplates this body upward from the soles of the feet, downward from the top of the hair, enclosed in skin, as being full of many impurities. In this body there are head-hairs, body-hairs, nails, teeth, skin, flesh, sinews, bones, marrow, kidneys, heart, liver, pleura, spleen, lungs, intestines, intestinal tract, stomach, feces, bile, phlegm, pus, blood, sweat, fat, tears, grease, saliva, nasal mucous, synovium (oil lubricating the joints), and urine. Thus he dwells contemplating foulness in this body. This, Ananda, is called contemplation of foulness.</p>
  
  <p>-- <a href="http://www.accesstoinsight.org/tipitaka/an/an10/an10.060.piya.html" rel="nofollow">AN 10.60</a></p>
</blockquote>

<p>The likely reason you were told it may lead to suicide is because one sutta documents how a group of monks performed suicide after doing this practice (<a href="http://www.accesstoinsight.org/tipitaka/sn/sn54/sn54.009.than.html" rel="nofollow">SN 54.9 </a>).</p>

<p>If one is mentally healthy (e.g. does not have suicide inclinations) and one is mindfull of <a href="https://en.wikipedia.org/wiki/Bodhipakkhiy%C4%81dhamm%C4%81" rel="nofollow">bodhipakkhiyādhammā</a> (e.g. one is able to direct his mind to joy, tranquility and equanimity), than I don't see danger in it.</p>

<p>Other than that, there was a US zen monk in recent times who, allegedly, was jogging and saw a dead corpse with a bullet wound in the head, thereafter deciding to come back to meditate over the corpse. As it so happens, <a href="https://en.wikipedia.org/wiki/San_Francisco_Zen_Center#Tenshin_Reb_Anderson.27s_arrest" rel="nofollow">he got in trouble with the police</a>. So, don't do that.</p>
 295: <blockquote>
  <p>How to do "contemplation of death" meditation ? </p>
</blockquote>

<p>With each and every in and out breath reflect: "life is impermanent, but death is certain, hence will attend to what need to be done without delay."</p>

<blockquote>
  <blockquote>
    <p>“But how, bhikshu, do you cultivate the mindfulness of death?”</p>
    
    <p>“Here, bhante, I do it thus:</p>
    
    <p>'Indeed, should I live just the time it takes to breathe in and then out, to breathe out and then in,
    I would wisely attend to the Blessed One’s teaching, much indeed would be done by me!'</p>
    
    <p>Thus, bhante, I cultivate the mindfulness of death.”</p>
  </blockquote>
</blockquote>

<p>Source: <a href="http://www.themindingcentre.org/dharmafarer/wp-content/uploads/2013/04/48.5-Atthaka-Maranasati-Sutta-1-a8.73-piya.pdf" rel="nofollow noreferrer">(Aṭṭhaka) Maraṇa,sati Sutta 1</a> and also similar passage is in: <a href="http://www.themindingcentre.org/dharmafarer/wp-content/uploads/2013/04/48.11-Chakka-Maranassati-S-1-a6.19.pdf" rel="nofollow noreferrer">(Chakka) Maraṇa,sati Sutta 1</a></p>

<p>A more detailed outline of the pratice is covered in: <a href="http://www.themindingcentre.org/dharmafarer/wp-content/uploads/2013/04/48.14-Maranasatikatha-vism7-piya.pdf" rel="nofollow noreferrer">Maraṇa Sati Kathā</a> by Piya Tan</p>

<blockquote>
  <p>and is it dangerous ?</p>
</blockquote>

<p>Not if you pratice it correctly. Even crossing the road the wrong way will have dangers so does meditation. Key to do it the right way as with any other endeavor.</p>

<p>The intention of this pratice is to create urgency and eliminate procrastination as time is running out and what can be done within a lifetime ends with death. (Also see section <a href="https://buddhism.stackexchange.com/a/14336/295">How do you banish laziness?</a>) Instead if you are developing a phobia or fear of death or some attraction to death or romanticizing with the concept of death or developing sorrow towards your pending death or of loved ones, then you are doing it wrong.</p>

<blockquote>
  <p>Cause i read it might cause someone to suicide - so how do i make sure i won't reach that situation ? and how exactly should i do this meditation - ...</p>
</blockquote>

<p>As far as I know repulsive meditation has resulted in suicides, but not sure on contemplation of death. These are 2 separate practices. The purpose of repulsive meditation is to counteract the perception of beauty in the form and shape of oneself and others and developing lust and taking pleasure and delight in such formations. If you are developing aversion towards the body one oneself as unclean or the perceived lack of beauty then you are doing it wrong.</p>

<p>Both these practices do also reinforce the perception of impermanence, more particularly impermanence of life as well as our corporal body.</p>

<blockquote>
  <p>... and for how long each time - ...</p>
</blockquote>

<p>I think a few minutes will do or as much as to keep you motivated to attend to what need to be done without procrastination.</p>

<p>Also an occasional reminder on the need of urgency as time is running out during the day may be helpful.</p>

<blockquote>
  <p>... and how many times each day ?</p>
</blockquote>

<p><a href="http://www.themindingcentre.org/dharmafarer/wp-content/uploads/2013/04/48.6-Atthaka-Maranasati-Sutta-2-a8.74-piya.pdf" rel="nofollow noreferrer">(Aṭṭhaka) Maraṇa,sati Sutta 2</a> and <a href="http://www.themindingcentre.org/dharmafarer/wp-content/uploads/2013/04/48.12-Chakka-Maranassati-S-2-a6.20.pdf" rel="nofollow noreferrer">(Chakka) Maraṇa,sati Sutta 2</a> mentions you should do it 2 times at least when the day has ended and when the night has ended. You contemplate some mishap can happen your life can end in the next part of the day hence be attentive to what needs to be done without fail.</p>

<p>Also see my answer to: <a href="https://buddhism.stackexchange.com/questions/14386/is-contemplation-of-death-auto-suggestion">Is contemplation of death auto-suggestion?</a></p>
