1. It’s no accident that the Players arrive at Elsinore when they do. Hamlet is just pretending to be surprised when Rosencrantz & Guildenstern tell him of their arrival. He knows they’re coming, because it was he who had sent for them. He’s been waiting for the players to arrive, so he can carry out his plan to stage The Murder of Gonzago (a.k.a. The Mousetrap) in front of his uncle Claudius.
2. When Hamlet summoned the Players to Elsinore, he also sent them the script of the play The Murder of Gonzago, of which he is the sole author. He had started writing this play immediately after his encounter with the Ghost. (There is some reason to think he may even have been at work on it even before then.) The notion that he has delayed taking action is therefore mistaken.
3. Although Hamlet speaks of his plan to put on the play as a device to test Claudius’ guilt, this is not his original, or primary purpose. (It’s just an after-thought, a belated rationalization to cool his nerves.) The real point is is just to insult and enrage his uncle, so as to provoke his hostility.
4. The reason why Hamlet wants to provoke Claudius’ wrath is to get himself out of the moral impasse in which he finds himself. Claudius is the legitimate king of Denmark, an elective monarchy. The fact he is also a murderer, the secret killer of the previous king (Hamlet’s father), does not detract in any way from the legitimacy of his election. Moreover, Claudius has designated Hamlet his intended heir to the Danish throne (as Hamlet’s own father had apparently failed or neglected to do). This means that for Hamlet to kill Claudius unprovoked would be morally on par with Claudius’ murder of his father, if not worse.
5. Hamlet’s essential difficulty, then, is that he must find a way to kill Claudius without ending up king himself. He succeeds.
6. It’s no accident that Fortinbras shows up at Elsinore at the very end, just after the fatal debacle. Hamlet had sent for him, too.