it depends on what you want the leg to do
You're asking for an energy efficient and fast pair of legs that allow a human to run and walk with maximum energy efficiency. My answer to that is to look into the legs of ratites, particularly ostriches.
You see, the key to why ostriches have energy efficient legs lies not only on the skeletal structure itself, but also on the muscular structure: the absolute majority of the ostrich's leg muscles are located near the top of its legs, close to the Body, while the absolute majority of the movement in the lower regions is reliant on tendons extending from these muscles. For a better comparison here's how different our muscle positioning is from theirs:

This association of elastic tendons allow them to loose minimal kinetic energy while moving, especially while running, while the muscle positioning ensures that the extremities of the leg are as light as possible and thus require less energy to move. Couple that with their trademark 2 toes, which provide the necessary traction without overdoing it (I sincerely couldn't exactly understand why exactly 2 toes is the best, just that it apparently is) and you got yourself the closest thing to a perfect leg for maximum efficiency. The rest of the work would be to ensure these legs have the space they need to anchor all these muscles. You might want to change the hip shape of your humanoids.
HOWEVER the ostrich leg has another major difference, and that is where I complain about their leg design: ostriches are the fastest and most energy efficient bipedal runners in the animal kingdom as far as I'm aware, but you know what they can't do even if their lives depended on it? Climb for dear life. In addition to minimizing muscle mass in the lower leg region and maximizing the use of flexible tendons in these extremities to keep kinetic energy loss to a minimum, there's one other key adaptation in cursorial creatures like horses and ostriches: minimizing sideways joint movement through an association of ligaments. Here's a quote from the link I posted:
A wide range of joint motion allows humans to climb trees or ballet dance, but this flexibility has a cost. When we run, muscle power is used for propulsion but also to prevent sideways joint movement, thereby increasing our energy requirements over a given distance. I suspected that ostriches had a more efficient approach.
Animals that don't need to and most of the time cannot climb anything due to living in predominantly plane regions where one of the only real strategies to survive is to outrun your predator. This environment better allows for the selection of creatures whose anatomy optimizes moving fast in 2 dimensions (your only options are straight line, left and right), meaning sideways motion is virtually useless to them, as the factors selecting them are "maximum" speed and "maximum" energy efficiency while using that speed (by maximum I mean only enough to allow them to survive and reproduce. Natural selection isn't a perfectionist), while arboreal creatures need to keep that movement because they are often pursuing or evading something while moving in a 3 dimensional fashion when suddenly up and down are viable choices.
Humans naturally came from a more arboreal group of ancestors, and our evolutionary history did not require us to maximize efficiency while running on the ground. A decently efficient walking pace allowed us to hunt our prey a and the invention of tools and group dynamics allowed us to defend ourselves from (and evetually cast "skidalle skinct you're not extinct") on many of the creatures that posed a threat. Thats most likely why today we're clearly not the best runners but also haven't completely lost the ability to climb a tree. For these and other reasons ostriches are the fastest running bipeds on the planet, but are completely incapable of sitting on a chair or climbing a tree, their lack of leg flexibility basically won't allow it.
So summing up: it depends on what exactly you want. If your goal is to get a leg that is essentially perfect for fast and efficient bipedal locomotion, but that will also make walls and a tall enough fences into absolute obstacles (unless you have the leg power of an emu and the fence is 6 ft tall, then you can probably jump over it with enough skill) using the anatomy of ostriches, or at least that of ratites is the best way to go (I don't exactly advise horses for anything other than seeing the similarities in their approach, since they evolved to work quadrupedally while ostriches are adapted for exclusively bipedal movement). If you do not want to compromise those movements, you'll have to settle for something that's not as great as running but also not the best at climbing. Changes to promote the loss or fusion of most of the 4 digits in the foot and modifications to the thumb should probably also be on the way.
Also, if you're having problems picturing ostrich legs on a humanoid body, maybe this view on what a potentially "perfect" human body would look like will help:

image link
And as for how they'd move, probably a mix of how ostriches walk and what you see in this video
Edit: if the ostrich model is truly out of question due to its almost complete inability to climb, but you still want something that is at least similar enough, my best bet for a leg structure would be something similar to that of a dakotaraptor and other dromeosaurids.

Dakotaraptor was a large, yet nimble predator that was discovered in the hell creak formation in the USA. despite its large size, anatomical features such as its pneumatic bones and skeletal structure indicate that, unlike the similarly sized utahraptor, predominantly an ambush predator too bulky to run like it's smaller counterparts, dakotaraptor was still well adapted for speed, with modern estimates being around 50 to 60 km/h (modern ostriches cap at 70),so out of the box they were clearly capable of moving quickly and efficiently. The fact that their overall skeletal structure is similar in proportions to is small counterparts, which were very much capable of climbing and swimming (as well as the the fact that T-rexes could do so as well), it's safe to assume that the biggest limitation would be whether they had the muscle power to drag their way up, still the problem isn't quite on the skeletal structure.
Add to that that both smaller raptors and modern ostriches show(ed) the ability to swim, this might be your best shot at a leg structure that's efficient for running and traveling long distances without completely sacrificing the ability to climb or swim (assuming your creatures aren't too heavy to be Able to pull their own weight upwards, which again is no longer a problem exclusive to whether they're naturally incapable, but rather the square cube law coming for you for growing too big without the proper adaptations to keep yourself light). Given however that emus can weight up to 37 kg as adults while still jumping 7 feet (2.1 meters) up in the air despite being around 5.7 feet (~1.75 meters), they should be fine so long as they're not absurdly heavy.
I still stand on my point however: no leg structure will ever be the best at everything simultaneously. If you want a creature to be something that can excel in every type of environment, your best bet would be to get into sci-fi superpowers and make it capable of shape-shifting so that it can adapt to its environment on the fly.