When the last big robbery is done, you'll have to finish the whole story once for all. Franklin will be visited by Devin who suggests killing Michael. Now you have to choose one of ways which will determine the game ending. Remember, that when it's done you can freely make all secondary missions and activities besides the missions connected with a dead character. Remember also, that you can't change your choice after you make it. If you kill any of your playable characters, you won't be able to resurrect him by replaying this mission!
Option A (killing Trevor)
Franklin will call Trevor and ask him to meet. Then, he'll call Michael and ask him to help kill Trevor, but he'll have doubts. During the encounter, Trevor runs away and Franklin starts chasing him. You'll have to run after him until the cut scene triggers (you can't damage his car). Michal will ram Trevor and he crashes into the fuel cistern. When you fire at Trevor, the gasoline starts burning and Trevor will die. If you wait too long, Michael will fire first at Trevor. After that, Michael and Franklin talks a bit and then each of them head in his own direction. After this ending, Trevor will disappear from the game world and you won't be able to make any missions you didn't complete to this point.
Option B (Killing Michael)
Franklin will call Michael and ask him to meet. Then he calls Trevor and asks him to help kill Michael, but he refuses. When you meet Michael, a cut scene triggers after which you start chasing Michael (you won't be able to kill him during that). After that, another cut scene triggers, due to which Michael falls out from behind a barrier but you catch him. You can now choose between letting him fall or releasing him, but even if you pull him up, he'll hit Franklin and fall down, killing himself. Then Franklin calls Lamar for a meeting. After this ending, Michael will disappear from the game world and you won't be able to make any missions you didn't complete to this point.
Option C (saving Trevor and Michael)
The longest, the most difficult but also, probably, the most rewarding ending. Franklin calls Lester to find a way of saving both of his friends. Lester will suggest a meeting in abandoned place, where you will fight both Merryweather and FIB. Before heading there, you'll get also Lamar. At the site, you four will be fighting against those two groups and they'll be fighting against each other. After this battle, they will make a decision to revenge all important persons who has caused those events. Trevor will ride to kill Steve Heines, Franklin will take care about Mr. Cheng from Chinese Triad and Michael will eliminate Stretch, who framed Lamar. When those three are dead, your next target is Devon Weston, who has to be kidnapped by Trevor. When it's done, in the next cut scene you will see your character together pushing car with him inside of the cliff and what finishes the revenge. Option C is a happy ending in which all three characters remain playable when the main storyline ends. You can play all uncompleted missions and those completed one by choosing them in menu.