I’ve done it both in the military and the civilian world. At major airlines, it’s pretty rare that you’ll fly into a place without mechanics. That said, there are odd circumstances as pointed out in other answers. In those cases, we do our best to coordinate with the pilots to get a very good idea of what the problem is.
Usually Maintenance Operations Center techs will try to find a local mechanic or even someone from another airline to get it going. Generally speaking, if the problem was that simple, the pilots probably didn’t need to divert anyway. Other airlines don’t mind helping with parts, but manning is another story. There are labor contract issues, payroll problems, etc... It gets complicated quickly. That’s usually when they call The Mothership and decide to bring a few mechanics in to fix it.
From there, we brainstorm most likely scenarios and also the most outlandish. We try to bring everything including the kitchen sink. From experience, no matter how easy you thought it was on the phone, and no matter what you bring, there is a guaranteed monkey wrench lurking in the midst. After all, if this was just any ordinary problem, the plane would have been off the ground already.
We usually dispatch to the plane by other commercial flights, or we drive to the location ourselves. Most guys prefer to drive because we’re usually on overtime for the majority of the trip... Might as well drive 8 hours on OT too...
Once we arrive, the mess we’re in quickly becomes apparent. We usually hem and haw in gaped astonishment at what went wrong. Then we realize that nothing we are looking at is what we were told over the phone. Then we call The Mothership and explain that we need some outlandish piece of equipment. It then becomes MOC job to get us that equipment somehow or some way. Still on OT, we make our way back to the hotel and wait for the call that our stuff is on the way.
I have changed engines with skyscraper cranes, performed wire splaces with two terminals, a bolt, a nut, and a piece of tape, and made adjustments to “non-adjustable” equipment to get a plane off the ground and into a better location. Sometimes you have to be creative but judicious in the repair process.
Usually, after days of lack of sleep and suffering from overexposure to cold, heat and/or other intolerable elements, we get the airplane up and go home. After our arrival, we fill out our travel paperwork, are summarily haggled to death by bean counters who have no idea what we have just done, and find that the 47 hours of OT we were billing the company for gets knocked down to about 12 hours plus a few denied receipts. In the end, you break even, go home, lie to the wife why there is a $2000 charge for “The Dollhouse” on the credit card and go to bed. Later that evening, you’re called to go on another trip and the cycle continues.