After a long hot day of slogging through biomes to find that elusive ocelot, or a cold dark scary night mining many levels down to the 'good stuff,' you realize you can't remember how to get home. Or maybe you're just thinking it's a heckuva long walk back. What to do when you don't have OP powers to just teleport! Not to worry young Skywalker, we have you covered. But you need to know some things first: about spawn points and beds, about commands, breadcrumbs and desperate measures. (Music to get Home Again by.)
The Spawn Point
When you entered this world, you did so at a very specific set of coordinates. Those coordinates are your "spawn point." This is your source. When you die, you will respawn at your spawn point.
Your bed has many uses. It can be used to reset or change your spawn point. Once you create and sleep in your bed your bed's location becomes your new spawn point. Remember it's not enough to simply create a bed; you must sleep in it at least once (at the location you indeed to be your new spawn point).
Your bed is also a great way to reset the time from night to morning, in single player mode, by right clicking on your bed to "use" it. In multiplayer mode, everyone online at the time has to agree to do it at the same time.
SHIFT F3 will open up a window in Minecraft that displays your X, Y, Z coordinates. (Yes, Bunky, geometry really was useful.) X and Z are the coordinates you want to pay attention to as you move. Y just tells you your altitude. So when you're at your home, write down your coordinates. You don't need all the decimals places; whole numbers will usually suffice. Then when you want to head home, show the X, Y, Z coordinates and move in a direction that gets you closer to your original location. This is a toggle. Hit the same key again to turn off the info on the screen.
A note to the Mac users: Yeah, our function keys are bound to stuff. Not a problem. Rather than go through the steps to disable the presets, just hold down the FN key while you hit the F3 key for the same results. (Click to enlarge illustration below.)
Remember Hansel and Gretel? To avoid getting lost in the forest they left a trail of breadcrumbs behind them (which the birds then ate, thereby ruining the plan, but that's how fairy tales go). If you know you're heading out on a big exploration, start dropping sign posts for yourself so you can retrace your steps to get back. These don't have to be actual signs; I use a stack of cobblestone, with an extra stone stuck on the side that leads home.
If you find yourself deeply lost in a mine and way way too far away to bother walking home (really? you're that lazy), you can always create a chest, store all your good stuff in it, and then commit suicide in lava, by drowning, or falling from a great height. You'll respawn at your spawn point. Good luck trying to find that chest; but someday you will. It's like finding a $5 bill in your jeans.
Two good items to use for getting back home are the compass and map. The compass will show you the general distance to your original spawn point, and the map will show you your exact location. However, these two items do have their cons. With a compass, you only know your general direction and it only points towards where you originally spawned. So if your house is far away from your original spawn point, you're in trouble. With a map, you can go completely off the map or if you can't locate your location on the map, it's completely useless. And good luck using both of these in the Nether or the End. The compass spins randomly, and the map only shows the top layer of bedrock.