If it's random I don't really see how I got through 7 times with all survivors. It's not just loyalty and equipment which makes the difference, but the specialists you choose, and even the conversation options you pick have an effect on it.
Also who you take with you to the final fight makes a difference too, because if you take your two best fighters with you then it diminishes the group left behind and increases the chance of someone dying.
during my last playthrough..i did almost everything right. but couldn't save Mordin Solus. should i take him along for the last fight? do u think saving the genophage data will have an effect in ME3?