To kick things off, there's a couple of misappreciations in your initial statement:
how unbelievably lucky the discoverers were to catch the wave produced billions of years ago by an event that happens so rarely one hour into a test run of their equipment.
This event is rare, but it isn't particularly rare: each pair of black holes will collide and emit waves once, for a few seconds, out of many millions of years orbiting, but space is big and there are lots and lots of black holes in the many millions of galaxies that are within 1Gly of Earth.
Ultimately, it comes down to (i) estimating the strength of the signal of a given event at a given distance, (ii) estimating the number of events that will happen within a given volume, and (iii) building a detector that is sensitive enough that its detection volume will include enough events to be worthwhile. All of these calculations were done way before LIGO was built, as part of building the case that it was a smart thing to build in the first place.
On another track, the claim that the detection happened within an hour of the first test run is inaccurate. The detection happened two days into the engineering run that preceded the first science run of Advanced LIGO, and there had been plenty of previous runtime on the standard and Enhanced configurations. The two-days time is pretty lucky, indeed, but not unreasonably so; the second detection, GW151226, happened within three months of the first one.
On to your main question, then. For many years running up to the science runs, there was a strong effort from the numerical-GR community to explore all known possible sources of gravitational waves and predict how the signal would look on Earth, how strong that signal would be, and how it would depend on the characteristics of the source.
The initial source, GW150914, was easy to pick out, because it has a very characteristic shape, which essentially seals it as a black-hole merger. Moreover, the waveform has a very characteristic duration, frequency, and chirp, and all of those can be directly related to the characteristics of the source collision.
Thus, these aspects of the shape of the pulse let us infer what the source was, including in particular the masses of the black holes and their orbit. This, in turn, tells us the amount of energy that was emitted, and from that we can infer the absolute 'luminosity' of the source, which we can then compare with the observed intensity of the waveform to obtain the distance to the source. This tells us 'where' the signal comes from, at least in terms of the distance.
The direction the signal came from, on the other hand, is worked out in a more mundane fashion, by looking at the relative delay in the observation of the two sites, which provides one constraint. In addition, since the waves are polarized and the two detectors point in different directions, the relative intensity of the two detections can provide additional information about the direction (but not as much). Thus, if you look at the area of the sky the signal could have come from, you get a pretty wide patch.