It takes advantage of the uncertainty of position in the electrons. Recall there is a very small chance that an electron (or any particle for that matter) might be found anywhere else in the universe if you look for it. Of course, the closer you are to the middle of it's expected position (the highest expectation value in it's spatial wavefunction), you are more likely to find it. So, with a STM you stick this wire really really close, but don't touch the substrate, and you pick up a tunneling current of electrons that quantum tunneled into your wire. As you move the wire horizontally over the surface, the topography of the substrate is given by the rise and fall of the tunneling current. So, you get a topographical map on an atomic scale. Interestingly, although I forget the type of wire we used, it had the property of being able to be cut to a very very sharp point. Using scissors and clipping it on an angle, you could get a tip of just an atom or two. The hard part was getting close, but not touching the substrate. Once you did, you bent the tip of your wire, and you needed a new one.