What happens if a passenger dies mid-flight?
In the event of a passenger dying on an airplane during flight, each case is different depending on the location of the airplane, the duration of that flight and the wishes of family or friends traveling with the deceased passenger.


What happens to the flight?
If the death occurs before takeoff or shortly after takeoff, the airplane is landed back to that airport or the nearest airport. If it happens mid-flight, normally the flight is continued to its destination.
Where is the deceased passenger placed?
If there is a seat available in first or business classes, the deceased person is moved there and covered with a blanket. If it is a full flight, that person may simply be strapped in more tightly and covered. This is done to ensure that the body is out of view of other passengers. A deceased person is never placed in the lavatory. It is not respectful and a major security concern.
What happens at arrival airport?
The arrival airport is informed in advance about the situation. Hence police, ambulance and coroner are available. Some airlines keep body bags on board. Normally the deceased person is placed on a stretcher and is carried from the rear exit of the airplane using a lift truck and then placed in an ambulance. This might be done after other passengers have exited the airplane.
What are the regulations?
FAA have regulations addressing several emergencies, but not specifically this one. An FAA spokesperson mentioned:


  FAA spokesman Les Dorr said he was unaware of any policies that
  specifically address what should be done if someone dies in flight.
  The airlines make those decisions on their own.



This article mentions some incidents of this situation happening.

MedAir is a company which provides airlines with medical help from emergency care doctors on the ground. They estimate that:


  ... there is one death for every 8 million passengers from the airlines [they] serve ...