This is the question most often asked about Hamlet, in one form or another. Why doesn't Hamlet just go ahead and kill Claudius? He makes some excuses to himself which do not sound entirely sincere or convincing. For instance, he tells himself in one of his soliloquies that the ghost he talked to might be the devil in disiguise. But he is still procrastinating up to the very end when he engages in a fencing match with Laertes and is wounded with a foil dipped in poison and finally kills Claudius in the heat of passion. We like Hamlet intelligent, funny, learned, charming when he wants to be--but we get irritated with his endless procrastination and introspection.
C. G. Jung, in his book Psychological Types distinguishes two "attitudes," introversion and extraversion, and four conscious functions, which he terms thinking, intuition, sensation and feeling. Jung's book has been used as the foundation of the Myers-Briggs Type Indicator (see reference link below). Hamlet, judging by the Myers-Briggs formula, would definitely be an introvert. His primary conscious function would obviously be thinking, and his complementary conscious function would probably be intuition. So he would probably be classified as ITNJ, or possibly ITSJ. The "J" stands for judgmental, and Hamlet is certainly that.
Jung emphasizes and repeats in Psychological Types that thinking and feeling are incompatible. A thinking person cannot have feeling as a complementary conscious function, and a feeling person cannot have thinking as a complementary conscious function. We can observe this in many people we have personally known, and perhaps also in ourselves. Now Hamlet's problem is that, as Coleridge observed long ago, he thinks too much, and his thinking paralyzes his action. Another way of putting it is that Hamlet needs to feel rage in order to commit a murder, however justified, and he can't feel murderous rage while he is thinking. The type of education he has received at Wittenberg has undoubtedly not only influenced his thinking but has also contributed to his confusion.
Hamlet can act forcefully and decisively when he isn't thinking. He boards the pirate ship single-handedly. He kills Polonius on the spur of the moment. He grapples with Laertes on impulse at the grave of Ophelia. He disarms Laertes during their heated fencing match and exchanges foils with him. Finally he kills the Claudius when he is still incensed from the duel and realizes the King's treachery.
Hamlet is essentially an introverted scholar who has an distasteful obligation thrust upon him to revenge his father's murder. He has studied at Wittenberg for many years and would like to go back there if Claudius were not keeping him a virtual prisoner at Elsinore. Laertes, by contrast, is an extravert whose primary conscious function is feeling. He doesn't stop to think when he barges into Claudius' private quarters and threatens to kill him and perhaps lead a spontaneous revolution. But Laertes' feelings interfere with his thinking, and so he is easily pacified and turned around by the wily Claudius (who is probably an ESTJ, pragmatic and cerebral).