In the story mode, whenever your stamina reaches zero the game does not automatically end. Instead, there's a chance to continue. The player awakens in this domain and is chased by the Haunting Shadow. If you run fast before the Haunting Shadow touches you, you escape to the Endly Altar (granting you a free savegame) and then back to the game. Getting caught by the shadow is game over. But beware, each time you enter The Ends the shadow gets faster. Offering food to the Endly Altar or consuming a Blackened Heart to save your game also make the shadow faster.
Usually you'll have two chances before the shadow becomes too fast to escape. If you save your game often though, you might make the shadow fast enough to catch you the first time you die. Offer a Pure Flower at the Endly Altar to cleanse the taint from this sacred place. Showing such favor will make the shadow slower and give you a Blackened Heart.