This really breaks down into a few categories:
Flyable aircraft, Flyable location
For general aviation aircraft or airliners that are in flyable condition (or only require minor repairs) and are located somewhere you can fly them out of the usual solution is to offload as much weight as possible, take off, and fly to an airport.
There are countless cases of light GA aircraft taking off from roads or fields after precautionary landings. In the large aircraft world the Gimli Glider flew out of the racetrack, and TACA 110 took off from a nearby road.
Flyable or Salvagable aircraft, Unflyable location
If the aircraft is flyable but can't take off from its current location, or if the aircraft is salvageable but requires more extensive repair work than can be accomplished where it is, alternative transport methods need to be considered.
For light aircraft the usual solution is to disassemble the aircraft, load it on trucks, and take it to an airport where it can be reassembled and repaired to be flown away.
This is also an option for most airliners, and was in fact the original recovery plan of action for TACA 110 that I mentioned above.
Disassembly, trucking, and reassembly is generally more expensive than flying the aircraft out of wherever you landed it, but aircraft insurance policies generally include provisions for this because simply leaving the aircraft where it is will often be even less economically attractive.
Wrecked aircraft, wherever it is
If an aircraft is largely intact but unlikely to fly again in the near future (or ever) due to damage the recovery operations are effectively the same as above, but they're dictated by legal and financial requirements: Environmental regulations may preclude leaving a wrecked aircraft wherever it landed, and financially the components and materials may be salvageable or valuable as scrap. As long as the costs of recovery are less than the profit to be made (or the fines to be incurred just leaving the aircraft where it is) and the hazards involved in the recovery are manageable the aircraft will usually be recovered.
On land the aircraft (or pieces of it) will once again be loaded onto trucks to be transported somewhere where they can be examined and then stripped/sold.
Aircraft in relatively shallow water will be generally recovered by dredging or hoisting with crane if doing so is feasible. This gets most of the "big stuff" (wings, fuselage sections, etc.) though in a badly damaged aircraft smaller pieces may be left where they are. (The recovery of US Airways 1549 is particularly spectacular in this regard, as it's hoisted basically intact.)
Aircraft in deep water are often not recovered - it's simply not feasible from a financial or risk management standpoint (sending people down to an extreme depth just to recover a machine that's going to be cut up and sold for scrap is hard to justify).