A driveshaft, drive shaft, driving shaft, propeller shaft, or Cardan shaft is a part of a machine that takes power from the engine or motor to a place where useful work can be done.

Most engines or motors create power as torque by making something rotate.  This can be from an internal combustion engine (as in a car), water driving a water wheel, or gas or water going through a turbine.  This rotating power is called torque.  The load that is turned creates torsion and shear stress.  Drive shafts need to be strong enough to take this stress.  A light drive shaft will more efficiently move the power to the load, so there needs to be a balance between strength and weight.

Automobiles
Most automobiles today use drive shafts to deliver power from the engine to the wheels.  Most cars made today are front wheel drive (the front wheels have the power to move the car). In this case, the drive shafts are between the transaxle and each front wheels.

In rear wheel drive cars, there are drive shafts between the differential and each rear wheel.  There is also a drive shaft running the length of the car, from the transmission up front to the differential in the back - in British English this is not called a drive shaft, but a propeller shaft, or prop-shaft, and the drive shafts may be called half shafts (since there are two that make one axle). 

There are different types of drive shafts used in automobiles:
 1 piece drive shaft
 2 piece drive shaft
 Slip in Tube drive shaft

The Slip in Tube Drive shaft is the new type which helps absorb energy in a crash, protecting the people in the car or truck. It is also known as a collapsible drive shaft.

Motorcycle drive shafts 

Drive shafts have been used on motorcycles almost as long as there have been motorcycles. Many motorcycles use a simpler chain or belt drive instead, but drive shafts need less care, and have a long life.  A problem with using drive shafts on a motorcycle is that gearing is needed to turn the power 90° from the shaft to the rear wheel, losing some power in the process.

Tractors

Farm tractors use a type of drive shaft called a Power Take-off shaft, or PTO shaft. This is a shaft that comes out the back of the tractor.  It can be connected to any farm equipment that needs power from the tractor engine, such as a hay baler or corn chopper. 
 This lets the tractor be used for a lot of different uses, and the farm equipment doesn't need its own engine, saving money.

Drive shafts in Bicycles

The drive shaft can also be used in a bicycle instead of chain-drive.  They have been used for the past century, although never becoming very popular. When used on a bicycle, a drive shaft has several advantages and disadvantages:

Advantages
 Drive system is less likely to become jammed or broken, a common problem with chain-driven bicycles
 No grease on the rider, and no "Chain bite" to grab the clothing
 Less care is needed than on a chain system when the drive shaft is enclosed in a tube, the common convention
 More consistent performance. Dynamic Bicycles claims that a drive shaft bicycle consistently delivers 94% efficiency, whereas a chain-driven bike can deliver anywhere from 75-97% efficiency based on condition.
 More space above the ground (ground clearance) for going over bumps or things in the path
 For bicycle rental companies, a drive-shaft bicycle is less likely to be stolen, since it obviously looks different. This type of bicycle is in use in several major cities of Europe, where there have been large city-run bicycle rental or sharing projects.

Disadvantages
 A drive shaft system weighs more than a chain system, usually 1-2 pounds heavier
 In its best condition, a chain delivers greater efficiency
 Covering the chain and gears with a metal or plastic cover solves some problems with chains
 Use of lightweight gears with a high number of ratios is impossible, although hub gears can be used
 Taking off the wheel can be hard to do

References

Machines
Auto parts