At the moment we only have Leia's best guess as to why Luke ran. It's possible that she was wrong, understandably fixated on her son's long-running psychotic episode.
My own guess is that Luke figured that Snoke was fixated on him and, furthermore, that
he would deprioritise everything except finding him. So, vanishing for a while would actually
reduce the damage the First Order would do as they would divert resources that they'd otherwise use for wider-scale atrocities to finding him.
Why the map? Yeah, that was a bit of a clunky narrative device wasn't it? My best guess is that, in deference to old Jedi/oriental mysticism tradition, Luke foresaw that the One to Restore Balance would, ultimately, come looking for him and would find him. All he had to do is leave a trail of breadcrumbs to follow and trust in The Force that she would somehow get the means and motive to do so. I mean, the keystone of the map was hidden within a few dozen miles of Rey's home, so I figure Max was meant to find her and bring her to Lune 'when the time was right'. As it turns out, Luke was right. Rey did ultimately come looking for him after confronting a Trial that would convince her that she needed to fight for Freedom, Justice and the Light.
There is no 'luck', there is only The Force
As for abandoning Rey on a barren sandheap hell-world? Well, looking at the family history, Skywalkers are notorious for making dipshit-dumb loser decisions about 'protecting' their families from metaphysical threats by making their lives miserable and emotionally traumatic. It's almost as if they
want to give them a narrative device to explain a vulnerability to the call of the Dark Side!
Seriously, the level of manipulativeness in both alignments' plans for their chosen main players terrifies me, sometimes. Anakin, Luke, Leia and now Rey have all been set up like pieces on a gameboard by
both sides to go through hell so they would be 'ready' to fight for their side. When you're playing chess with trillions of lives, the happiness of an individual is so insignificant as to be funny but still...!