The right to life is a moral property of human nature. Therefore, you cannot really give up your right to life anymore than you can give up being a man. When you give up your life (say, for a good cause), then you are merely giving up the ability to exercise that right, but you are not giving up your right to life. You also cannot sell it, or transfer it. This is why it is called an inalienable right. No one can take it away from you, not even yourself. This does not mean that no one can take away your life, but only that they can’t take away your right to life.
Actually, the right to life is not the only natural and inalienable human right. A person also has an inalienable right to liberty and to the pursuit of happiness. These rights belong by nature to every human being. And they cannot be taken away, although people can be prevented from exercising these rights. Some totalitarian governments may not recognize one or more of your natural and inalienable rights. That does not mean that you lose your rights under a totalitarian government, but that they are simply putting an impediment to the free exercise of your right.
The right to life is not the same as the instinct of self-preservation. A right commands an obligation on others to respect that right. Instinct commands no such obligation on other people. The State has a responsibility and an obligation to protect your life, not because you have an instinct to survive, but because you have a right to live. Even if you lose your instinct or “will to live”, the law still ought to protect your life because of your right to live.