It's not really surprising that Hamas freed him. Alan was snatched by a powerful family clan that brutally controls a part of lawless Gaza. Since seizing power in the Gaza Strip from Fatah they have been desperate to legitimise themselves and the freeing of Alan was a top priority. I'm sure they hope that this will win them credit from the West and help boost their credentials internationally as they have been totally isolated by everyone.
I worked for the World Service during the 1990's but do not know Alan. When a journalist goes missing like this however or, still worse, gets killed in the line of duty, you sense a kind of kinship. I'm so pleased he got out alive - and I'm sure many others - journalists and non-journalists - are too.