A lanyard is a cord or strap worn around the neck, shoulder, or wrist to carry such items as keys or identification cards. In the military, lanyards were used to fire an artillery piece or arm the fuze mechanism on an air-dropped bomb by pulling out a cotter pin (thereby starting the arming delay) when it leaves the aircraft. They are also used to attach a pistol to a body so that it can be dropped without being lost. Aboard a ship, it may refer to a piece of rigging used to secure or lower objects.
Lanyards are widely used with small electronic devices such as cameras, MP3 players and USB flash drives to prevent loss or dropping. Electronics designed to take a lanyard usually have a small through-hole built into a corner or edge of the case or anchored to the frame of the device; the corresponding lanyard generally has a loop of thread on the end that is attached to that hole with a simple knot, usually a cow hitch. Some earphones incorporate the audio signal into the lanyard, meaning it doubles up as headphone cords as well.
Source : Wikipedia