I've been through the game twice now, and I've found that ALL factors need to be taken into consideration! Haha. On my first playthrough Four people died, on my second only two died. The first four were a result of not upgrading shields, tech and biotics enough. My second playthrough I fixed the Biotics, but apparently not enough for the sheilds and tech; I lost Grunt and Jacob =/
So, in my two playthroughs, it seems if you want EVERYONE to make it out, you better do your hardest to upgrade every possible tech, biotic, shield, health and weapon possible. Oh, and of course the ship. That's the most important.
Oh, and also, when you have those breaks in between and you have to assign certain squadmates to certain duties, pick WISELY. Don't send Grunt in as the tech specialist; Choose Tali, The Professor or Legion. Don't use Miranda or Jacob to be your Biotic barrier; Choose Jack or Samara. Don't choose Jack or Tali for your second team leader; Stick with Jacob, Miranda or Garrus. Common sense stuff, really.
Hope this helps!