1. If the armor upgrade for the Normandy is not purchased, Jack dies.
2. If the shield upgrade for the Normandy is not purchased, one of your non-party selected companions will die in this order (first one not-party member dies): Kasumi, Legion, Tali, Thane, Garrus, Zaeed, Grunt, Samara/Morinth
3. If the weapons upgrade for the Normandy is not purchased, one of your non-party selected companions will die in this order (first one not-party member dies): Thane, Garrus, Zaeed, Grunt, Jack, Samara/Morinth
4. For the "Specialist in the Vents": Only Tali, Legion, or Kasumi (IF they are loyal) will survive, also assuming you picked a good leader for the first fireteam!
5. For the "Leader of First Fireteam": Only Miranda, Garrus, or Jacob (IF they are loyal) can successfully lead the first fireteam and get the Specialist out in time.
NOTE: If anyone else NOT listed is selected for either role in 4 or 5, the Vent Specialist will die.
6. For the "Biotic Specialist": Only Jack, Samara, or Morinth (IF they are loyal) will hold the barrier with no causalities.
If someone else is selected, ONE companion will die in this order: Thane, Jack, Garrus, Legion, Grunt, Samara, Jacob, Mordin, Tali, Kasumi, Zaeed, Morinth
7. For the "Leader of Second Fireteam": Again, only Miranda, Garrus, or Jacob can lead successfully without being killed at the end. NOTE: If I recall correctly, Miranda actually DOES NOT need to be loyal for this segment for her to survive (for the first fireteam she DOES though), however, Garrus and Jacob DO need to be LOYAL to survive leading the second fireteam.
8. Do you send a companion to escort crew back? YES! If you do not, the crew DIES. It DOES NOT MATTER which companion you send, as long as they are LOYAL. Mordin is the most popular choice for this assignment, as he seems to die at strange times. Mordin, if LOYAL, will return the crew safely, for example.
9. The two squad members to take with you into the final battle with the Reaper must be LOYAL to survive. Doesn't matter who comes with you. "Hold the line" companions will survive if they are LOYAL as well.
There you go. If you get all 3 upgrades for the Normandy, do all companion Loyalty missions, and make smart choices for Vent/Biotic Specialist and Team Leaders as listed, all companions come out alive! Have fun!