Using cobblestone, there is an "L" shape in the block looking at it from the top.
When the "L" is in the top left corner and right side up, then you are facing north.
Please refer to this awesome paint diagram.
Note: Once seen, can not be unseen.
Also works on netherrack.
gaming.stackexchange.com/users/4393/Resorath
In addition to what sjohnston said, clouds always move west.
gaming.stackexchange.com/users/1719/Invader Skoodge
Above ground, you can use the sun or moon to orient yourself.
They both rise in the east and set in the west.
Also, according to an answer here , you can punch the ground, and the pattern of cracks will always be oriented the same way relative to north.
Finally, there are third-party mapper programs that you can use to orient yourself (although I haven't used any and can't vouch for them).
Some players might consider this cheating, or at least unsporting.
gaming.stackexchange.com/users/816/sjohnston
A great trick is to use redstone ore.
When you place down the redstone, there is a cross shape on the block.
On two of the 4 arms, there are rectangle shapes.
When you orient yourself so that one of the rectangles is to the left and one is in the front, you're facing north.
gaming.stackexchange.com/users/4342/Nick H
Press F3 to get the debug menu, then look under the x, y, z coordinates and see the letter "f".
This gives you the direction you're facing (0 south, 1 west, 2 north, 3 east).
If you need more help then you can also go to the Minecraft wiki and look up anything you may need.
gaming.stackexchange.com/users/35565/Tom
The current answers are excellent.
You could also try Zan's Minimap Mod , which works in both SSP and SMP.
However, since Minecraft 1.6 is releasing this week, and one of the new features is going to be a map, this mod may become obsolete very soon.
You can also set waypoints with it.
EDIT:
Since the maps of Minecraft 1.6 are virtually useless, I've just installed the new update for this mod, which now displays coloured wool as the appropriate colour, and as a bonus, no longer requires Modloader to install.
I'll also include a video of the mod in action.
gaming.stackexchange.com/users/3114/GnomeSlice
There is a program called cartographer, and if you build an arrow on the ground and then load your map in cartographer, you can see what direction your arrow is pointing...
But if you know the direction of the sun moon and clouds, you can then orient yourself from there.
Consider building landmarks to keep yourself oriented quickly
gaming.stackexchange.com/users/2835/Dream Lane
This is an old question, but now you can easily see the direction you're facing in the F3 stats: Look for the field that says "Facing", on the left.
It will be north, south, east, or west.
gaming.stackexchange.com/users/161340/Hutch Moore
If you have a few minecart tracks available, you can use the south-west rule to orient yourself.
There are two ways:
Orienting yourself using cross-intersections (and a minecart)
You need one minecart and at least 5 track pieces.
Lay out two cross-intersections (or lay out one, destroy, and lay out the second).
Then, put a minecart on it, push the minecart and watch the direction it moves when hitting the cross.
Look at this image from Minecraft wiki to understand what I mean.
Orienting yourself using T-intersections You need 4 track pieces.
The T-intersections also try to follow the south-west rule when they are laid out on the ground.
If they are unpowered (no button or redstone powering the T), the curve will try to point to south-west.
So, if you lay out two T-intersections, you can orient yourself.
Look at this image from Minecraft wiki to understand what I mean.
gaming.stackexchange.com/users/1552/Denilson Sá Maia
You can find East by keeping a sunflower handy.
When placed, sunflowers always face east.
gaming.stackexchange.com/users/239803/Chuck Cartia
A map can easily and precisely tell you which direction you're facing.
Craft a map, put paper around it until it's the largest size, and you can easily determine your direction at any time in a large area.
gaming.stackexchange.com/users/27903/Gigazelle
In Minecraft, it's useful to know which way is north in order to determine how to manipulate mine cart tracks. Usually, people keep track of which way is north by placing torches on the northern walls of their mine shafts.  How can you initially determine which direction you are facing?  (Above ground)
How can I determine which direction I'm facing?
gaming.stackexchange.com
<minecraft-java-edition>
gaming.stackexchange.com/questions/8693
gaming.stackexchange.com/users/18/Kevin Yap
Using cobblestone, there is an "L" shape in the block. You can also use the sun or moon to orient yourself. Therea are a variety of ways to tell which way you are facing, e.g. there is a marking looking north on cobblestone, or knowing that clouds always move west. Within the game, you can also use the sun and moon to orient yourself or craft a map.
Users suggest using markings on stone Users suggest using a map or looking at the sun and moon Users know that clouds always move west in the game