(1) Pakistani intelligence (ISI) knew exactly where he was for years, and probably advised him of the best way to hide out. He was living in a walled compound in a Pakistani military retiree's community, in a home that had no phone or data connections.
(2) Either someone in the ISI was bribed or the administration cut some deal in order to get the location.
I read that one of our Gitmo-types tipped us off as to the identity of a courier a few years back, and we've been following him ever since, eventually to Bin Laden. Apparently, Gitmo interrogation works.