More than 800 million passengers flew on U.S. carriers in 2015, according to the U.S. Department of Transportation. On a handful of those flights, sometimes the worst happens -- a passenger dies while on a flight.
During a flight
One of my flight attendant friends was flying to Portugal on an uneventful flight when a passenger passed away just an hour before arrival. When they discovered the passenger was dead, on a full flight, just before final descent they improvised.
A blanket, and a tightened seat belt covered the passenger and kept him strapped in. The flight was full so there was nowhere else to put him and the flight was descending (and he was seated beside a window), so covering him up and strapping him in was what they decided to do.
Because it was an international flight and the death was deemed to have occurred outside of Portuguese airspace the aircraft was quarantined (but thankfully for the crew, they didn't have to sit out any of the quarantine period on board). It did make returning home a bit more complicated, but the crew did say the saving grace was the passenger who died was a Portuguese national, so the quarantine was much shorter than it might have been.
The Federal Aviation Administration does not have any rules for airlines on how to handle inflight deaths, but the procedures are similar across carriers. It's rare that a flight is diverted to handle a passenger who has died.
After the flight crew and any medical personnel onboard exhaust efforts to revive a passenger, the next step is to put the body somewhere where it's not blocking exits or causing undue stress to other passengers. There usually isn't an announcement in order to ensure that passengers remain calm during the remainder of the flight.
If the flight isn't full, a body will be put in a row toward the back of the plane and covered with a blanket or other clothing. If there are seats available in first class, it may be put there also. But if the flight is full, the airline usually keeps a body bag onboard and the deceased is put into the bag and laid out in the rear galley. The only place a body isn't put is in a lavatory because it can be hard to remove after rigor mortis sets in.
Once the flight has landed, passengers are released to leave the aircraft. Once the plane is clear, the proper medical personnel come aboard and remove the body. If the person was traveling alone, the airline will call the next of kin and inform them of what happened on the flight.