This is a quick and simple guide on how to not get lost in minecraft caves.
If you are playing alone, this is easy, if you are playing with friends, you have to make sure everyone uses the same system of navigation. This is what our server uses (Pootis server).
When you are moving down into a cave, always put torches on the right. (top picture)
When you discover a dead end, go back, and mark it with 2 cobblestone with torches on top. (bottom picture)
If you are lost, put torches on the floor rather than on a wall.
If you need to light up to prevent spawning mobs, put torches on the floor.
This way, you will always know what way to follow when you want to get out. If the torches are to your left, you know you are moving out. If the torches are on the right, you know you are moving into the cave.
There are more signs to use, for example a 2 dirt blocks with torches to indicate a loop.
These blocks are arbitrarily chosen, and on your server different blocks may mean different things, or there is a different sign systems in place, it is best to check the rules of your server before starting to use such a system. Of course, you can always use a wooden sign, though they take more time and effort to set up so hardly anyone uses them. That is why we use the torch system.