See Mission Accomplished for more details concerning the final mission. You have to keep your entire squad alive throughout the final mission and save whatever Normandy crewmembers are on the Collector’s base. If every squad member is loyal, then you shouldn’t have any problems (provided that you choose the right person for the various jobs). If someone isn’t loyal, then you’ll have to rely on the character’s defensive statistics, but I’ll refer to that later.
*Before going through the Omega 4 relay, make sure that you have EVERY Normandy upgrade (armor, weapon, and shielding). See Suicide Mission for details.
What follows is the best crewmember for each choice. Do not send anyone that is not loyal. They won’t survive.
Vents: Tali, Kasumi, or Legion
Fire Team Leader: Garrus, Miranda, or Jacob
Biotic Specialist: Samara/Morinth or Jack
Fire Team Leader (Part 2): Garrus, Miranda, or Jacob
Escort: Mordin, Kasumi, Tali, or Jack
The four choices for the escort team are the weakest defensive characters. You want to get rid of one of them there. If you’re not playing on Insanity, then take two of them with you into the final battle.
For example, if Jack isn’t loyal, then you want to leave her with the rest of the crew to hold the line. You want to leave her with characters like Grunt, Zaeed, or Garrus who are strong defensively. If you leave someone that is disloyal behind without at least two of those characters, then they will die.
Each character has a defensive rating. Grunt, Zaeed, and Garrus are all 3. Thane, Legion, Samara/Morinth, Jacob, and Miranda have a defensive rating of 1. Mordin, Kasumi, Tali, and Jack have a rating of zero. If you add a 1 to each rating if they're loyal, add up all of the ratings, and then divide by the total number of characters holding the line (in short, take an average), if the average rating is above 2.0, then all will survive. If it's below, then anyone that isn't loyal or weak defensively will die.
The way I did it with one character not loyal, I sent Kasumi back as the escort and took Mordin and Tali with me into the final battle. That left Jack with every other character defending. Every character survived despite Jack being the only one that wasn’t loyal.
If you're trying to do this in one playthrough, but are concerned that you won't be able to keep everyone alive on Insanity, then don't fret. Make an extra save before you pass through the Omega 4 Relay and beat the game. After you're done, reload the save, lower the difficulty, and play the final level again. It will be much easier and you'll have no trouble keeping everyone alive.