At the end of Act 5, where all of the royal family dies, why does Hamlet appoint Fortinbras to become King of Denmark, even though they are rivals?
It seems that there are no more successors to the Danish throne who are of noble blood, and Hamlet perhaps wants to avoid further bloodshed that might result from a succession crisis. He only says that Fortinbras has his "dying voice." In any case, Fortinbras is not really Hamlet's rival by the end of the play. In fact, his life is similar to that of the title character. His father is dead (killed by Hamlet's father) and his uncle takes the throne upon his death. He threatened to invade Denmark to reclaim lands lost by his father, but Claudius negotiated a settlement with him. Later in the play, Hamlet expresses his admiration for Fortinbras, who has achieved much to be as young as he is, i.e. about Hamlet's age. The sight of Fortinbras's army marching toward Poland actually motivates him to speed up his plans for revenge. So it is not really the case that they are rivals.