How to get back to the main menu when dead?

Ok so i need some help.

When i die in my game, how do i make it so it goes back to the main menu?

And where would i add this code to?

The most reasonable place to put it is where the code for dying is.

Application.LoadLevel("MainMenu");

If you have several ways of dying (hard to tell without any code samples or explanation):

if (health<=0) {
    ShitHitsFan();
}

function ShitHitsFan () {
    Application.LoadLevel("MainMenu");
}