I think we knew for years that he was hiding in Pakistan. I think that the Paki military and intelligence knew where he was. In spite of the enormous population both Pakistan and India have a good intelligence network and can find people rather easily..if they want to. There are lots of neighborhood people, like police, servants, etc with lots of time to observe and gossip.
I also think it was entirely possible that the Pakistan military was told to stand down while the raid went on...just like they are told when a drone strike is planned..