Mind Over Matter
Hiking is physical. No doubt about it. If you do it long enough, say thru-hiking for 6 months, it becomes a mental battle more so than a physical battle.
Let me explain.
If you're literally hiking everyday, climbing mountain passes and making miles, you'll be in the best shape of your life after a few months.
When that happens, knocking out 15-20 miles a day is "easy". Because you're not huffing, puffing and can hold a conversation as you climb. You feel amazingly strong!
And your mind can now focus on other things besides an aching body. Good, bad & ugly.
On all my hiking adventures, there have been periods where it's tough to stay motivated. To keep pushing when you sorta have to. Bad weather? Still need to push forward. Sun going down? Hurry up and find a flat spot for camp.
You start to think of how many hundreds of miles or months are still left. Hating a particular stretch of trail, for no good reason. You get inside your head.
It takes a lot of strength to know when to push through and when to take a breather. More breaks through the day or zeros (days off of hiking).
Being around good people while hiking helps a lot with your mental state. When you're all suffering a particular stretch of trail, it'll be fun to laugh about it later. The drive to get into town for a nice hot shower, food, to watch tv and lounge around can be a strong motivator and boost you mentally. Telling your story to people you meet along the way can help.
If you boil down hiking to it's simplest form...
...Put one step in front of the other.
Most everything will work out in the end.
Mind over matter.