This page of the game guide to Borderlands 2 will inform you about the mechanics of the Fight for Your Life mode, which turns on if your hero is very close to death. This mechanic will allow you to return to the world of the living, provided that you fulfil some requirements.
When your health and shield fall to zero, the Fight for Your Life mode will launch. At the bottom of the screen a gauge showing time to your death will appear.
Before the gauge fall to zero, you have to kill an enemy or get reanimated if you're playing with somebody else (by holding down E by default). If one of the above conditions is fulfilled, you will be resurrected. Your shield will recover to 100% and you will be able to continue the game.
If you however won't be able to kill anyone or no one will heal you, you will begin back at the nearest checkpoint and lose some of your money. If you know there are no chances of returning to the living, hold down E to respawn.