How are the 4 km arms of LIGO measured so accurately?
It is a misconception that LIGO is a very accurate instrument, it has an uncertainty in calibration which is on the order of 10%. This means that the measured strain amplitude of GW150914 of $1.0 \cdot 10^{-21}$ could easily have been $1.1 \cdot 10^{-21}$. Note that this is just a scaling error.
LIGO is however extremely sensitive, it can measure relative length variations on the order of $10^{-22}$, but only in a bandwidth between 10 and 2000 Hz. At lower frequencies, the measurement fluctuates by several orders of magnitude more. You need to do band-pass filtering to reveal the actual signal.
As already mentioned in Chris's answer, a Michelson interferometer can only measure incremental changes in the path length difference. It does not say anything about the absolute length of the arms, and not even about the absolute difference in arm lengths. For a perfect Michelson interferometer, the resulting power on the photodiode is$$P = \frac{P_0}{2} \left(1 + \sin\left(4 \pi \frac{L_1 - L_2}{\lambda}\right)\right)\,,$$which will only tell you how much the difference in the arm lengths changes over time.
Still, there are reasons why you want to have the long arms as equal as possible. For a simple bench-top interferometer with a crappy laser diode, the path lengths need to be reasonably similar, otherwise you run into problems with the coherence length. This is not an issue for LIGO, they use Nd:YAG lasers which already have a coherence length measured in kilometers when running alone. These lasers are further pre-stabilized by locking them on ~16 meter suspended cavities, and finally the laser frequency is locked on the average length of the two 4 km long arms. The resulting line-width of the laser is on the order of 10 mHz, so a coherence length larger than $10^{10}$ meters ...
You still want to make the length of the 4 km arms pretty equal, since any imbalance would couple residual noise of the laser frequency to the differential length measurement. With standard GPS-based surveying methods, the mirrors are positioned with an accuracy on the order of millimeters. There is no need to do this much more accurate, since there are other sources of asymmetry that can couple frequency noise to the differential measurement, such as the differences in absorption and reflection of the mirrors used in the two arms.
The great thing about Michelson interferometers is you don't care how long the path lengths are, at least not at that level.
You build your apparatus and tune it until the phase difference you want appears at your detector. Note that given one valid solution you can shift one of the mirrors by an integral number of half wavelengths and get another valid solution. So whether the path length is $3{,}759{,}398{,}496$ or $3{,}759{,}398{,}497$ wavelengths long, you see the same thing.
Better still, in principle you don't really even care what the actual phase difference is at your detector when there is no signal. You could for example tune the device so the beams add constructively at the detector, and then look for decreases in intensity as your signal. Essentially all you care to measure are changes in phase difference.
Where the length matters is in an overall multiplicative constant in your measurements. A $4\ \mathrm{m}$ detector would need a much more powerful wave to get the same signal as a $4\ \mathrm{km}$ detector. But it's easy to build a tube to be $4\ \mathrm{km}$ long with an uncertainty of less than $0.1\%$, and it's even easier to measure the length afterward to correct your measurements by. This is just an overall uncertainty, and certainly no one is trying to measure the signal itself to one part in $10^{21}$.
If you want the distance between the mirrors in the two arms to be identical, you can tune it - but as is noted in Bas Swinckels' answer, they don't need to be so close together to do their job; and in fact, they are not tuned to be exactly the same length.
However, I would like to explain how, in general, if you have a large "Michelson interferometer" type of setup, you can get these distances ridiculously close.
If you have no idea how far apart your mirrors are, you can start by sending a short laser pulse down each arm and measure the round trip time; assuming you time to about 10 ps (which is really quite easy), you now have the distance to 1.5 mm (round trip distance uncertainty 3 mm).
At this point, you can use a narrow band light source to look for interference fringes: as long as the coherence length of the light is greater than the difference in path lengths, you will be able to see some fringes; as you move towards the position of zero path difference, the fringes get brighter. Depending on the width of the spectral line you use, this can get you quite close - say within 5 wavelengths of the "zero path difference".
Once you get really close, you can use a white light source to repeat the experiment: this has a very short coherence length, so while you will get constructive interference at zero path length with a near-black fringe on either side, you will lose the interference pattern very quickly. This can be used to find the "absolute zero path difference" distance - where the white fringe is centered in your field. For the LIGO experiment, you actually need a dark field (greater phase sensitivity), so you need to be off by half a wavelength.
An example of what I'm talking about is show on this site:
Once you have the zero path difference, you change to your very stable lasers, and tune the distance one last time to get the most perfect extinction you can. Because when you are looking for such a tiny phase shift, you will only detect it if you're working close to zero (so that the measured intensity is proportional to the phase difference).
Note that with a sufficiently stable laser, you might think you could be operating several wavelengths away from the "zero"; but when the phase differences you are looking for are this small, you really can't afford to allow additional phase jitter from any source to creep in. And the only way to prevent that is to make sure you have the same number of wavelengths in both arms.
And then you wait...