How does Apple fix the sleep-wake button issue on the iPhone 5?
I replaced this myself and it's very tedious and time consuming.   There is a ribbon cable in the phone that connects all of the exterior buttons/switches to the motherboard.  Usually the physical button you see from the exterior of the phone is not the problem, it's either the tiny button that button presses (attached to the end of the ribbon cable) or something with the wires themselves within the ribbon cable.

In case you're curious, here are instructions for how to do it yourself and what the inside looks like but I'd advise against doing it yourself unless you have experience with this sort of thing, a lot of time to kill, the phone is already out of warranty, and you could go without use of the device you're repairing.

The $5 cable I bought on Amazon worked for a few months but started to fail itself.  I'd recommend paying to have Apple do it.