During the Battle of Hoth, Luke's speeder crashes and is then crushed by an AT-AT. Later, he is seen flying out of Hoth in an X-Wing. Is there any explanation about how he got back to Echo Base? Wookiepedia lists it as "he works his way back". Legends or canon is fine with me for an answer, even video game explanations work.
He got a ride
This is addressed in Complete Locations, both the 2005 Legends edition and the 2016 canon edition. On the map of the Battle of Hoth, there are illustrations of Luke's route through the battlefield. His trail on foot ends not far from where he brings down an AT-AT (dot 6):
Back at Echo Base, an info box says:
After destroying AT-AT, Luke is picked up by team member and brought back to Echo Base
(Complete Locations (2005) and Complete Locations (2016), page 142: Battle of Hoth)
From there, his path leads to his X-wing:
(Images are from Complete Locations (2016))
It's not specified in what way he was "picked up", but there were a few Rebel ground vehicles canonically present at the battle of Hoth that aren't given much screentime—for example, the Rebel cannon sled:
The canon junior novelisation indicates that Luke walked (or rather trudged) to where his X-Wing was waiting, slightly away from the base. As such, a downed pilot on foot would be of minimal interest to the Imperials going in the opposite direction.
And then an explosion presses you into the ground. A wave of heat courses over your body. You are lying on your back, the snow rapidly melting around you, fire licking your chest. Then it subsides. You raise the blackened visor of your helmet. The snow walker is dangling from its own legs, a blackened husk.
You get up and run.
On a remote part of the ice field, far away from the battle and the now-ruined rebel base, you trudge through the snow. A short distance farther sits your X-wing, a spaceship outfitted for one pilot and one droid. R2 is in his place. He’s the one who piloted it out here to the muster site, to wait for you. The last of the other pilots are taking off, leaving a strange sight: a spaceship, small and lonesome, sitting on the edge of a frozen wilderness. The sounds of battle seem very distant out here.
This agrees with the original official novelisation which has Luke deciding to evacuate after he hears that all forward personnel have left the battlefield.
Withdrawal? Luke thought a moment. Then Leia and the others must have escaped! Luke suddenly felt that all the fighting and the deaths of loyal Rebel personnel had not been for nothing. A warmth rushed through his body, and he gathered his strength to rise and begin making the long trek back toward a distant formation of ice.
Luke waved and began to walk toward his X-wing. Standing there amid the mountains of ice and snow, he was overcome by a surge of loneliness. He felt desperately alone now that even Han was gone. Worse than that, Princess Leia was also somewhere else; she might just as well be an entire universe away …