There are three different ways to respawn depending on the difficulty you are on.
Peaceful & Easy Mode
You can simply respawn without any penalties.
You can choose to respawn with the penalty of losing any items on you, or you can have another player pick you up and place you in a bed with no penalties.
You will need to be picked up by another player and put in a bed in hard mode to respawn.