I never, ever, get lost.
Some of my hikes are just a little longer than planned and I don't always end up where I thought I would.

Worse case I walk any of the cardinal directions and hit either ocean, Mexico, or Canada. It isn't like I'm going to walk my way to Japan by accident.

The key is to know what you know. Virtually every piece of land is bounded by clear and obvious boundaries. Highways, rivers and oceans are good. As long as you keep your boots off the hard and dry you pretty much know where you are. Unless you insist on placing yourself in one of those few exceptional places it is pretty hard to find a location that isn't bounded every five or ten miles in any direction.

So you know, at least generally, where you are. Given a block of land ten miles square it is pretty hard to walk 14.14 miles in a straight line in any direction without hitting a boundary.

Know what you know and realize your not really, in the wider sense, lost.

Second, know your constraints. Make a good accounting of how far your resources of food, water, strength and energy will carry you. The more critical the situation the more risk you take. Let this guide your route. Choose your path out carefully and wisely.

Third, and possibly the most important key: Once you decide on a route stick to it. Too many people vacillate and second guess themselves. In a 10 mile square the maximum length of a straight path is 14.14 miles. But if you walk in circles, or keep reversing course, the path may have no end.