Hamlet's "What a piece of work is man" speech first of all should be taken with a grain of salt. He delivers the speech to Rosencrantz and Guildenstern , after all, who are his school friends that he doesn't trust—with good reason—not to sell him out to the king...
Hamlet's "What a piece of work is man" speech first of all should be taken with a grain of salt. He delivers the speech to Rosencrantz and Guildenstern, after all, who are his school friends that he doesn't trust—with good reason—not to sell him out to the king for their own advancement. Remember that acting mad is one of Hamlet's first stratagems to uncover his father's murder after speaking with the late Hamlet's ghost.
Second, the speech isn't so much conveying incoherence in Hamlet's thought process as a sense of deep sadness, closer to Hamlet's attitude at the beginning of the play before he learns his uncle murdered his father (and when he's merely mourning his father and angry that his mother married his uncle with such unseemly haste). In fact, Hamlet's words remind me of the symptoms of some experiencing clinical depression: he describes the Earth as a "sterile promontory," the heavens as a "foul and pestilent congregation of vapors." He says he takes no pleasure in man or woman. His diatribe reminds me of the symptoms of depression because he says he doesn't know why he feels this way.
Again, there are two ways to look at these words. First, Hamlet could be lying when he says he doesn't know why he feels such sadness. He has good reason to be unhappy: father murdered, murdering uncle usurping his birthright, mother marrying said uncle, friends betraying him, not being allowed to go back to school. Hamlet's refusal to ascribe a cause to his sadness could simply be another instance of him playing the fool. Dishonesty is, after all, one of Hamlet's tragic flaws. It's not necessarily evil in the play, because he's doing it for a cause: in this sense, Hamlet would be a tragic hero, someone whose plight is caused by defect of character, not wickedness. The point is debatable: to medieval sensibilities, underhandedness was wrong no matter what—in the Divine Comedy, Odysseus ends up in Hell for being a trickster even though his cunning was a weapon used in time of war.
Whether or not Hamlet's use of artifice in pursuit of just vengeance is wrong in essence, his schemes backfire with too much collateral damage. Hamlet justly dies for the innocent lives he destroys, killed by Claudius's own schemes and by hotheaded Laertes, who also abandons forthright confrontation in favor of trickery (using a poisoned sword in a "friendly" fencing competition) and also dies for it.
If Hamlet isn't lying in this speech, that simply reveals another of his tragic flaws: sloth. Depression not only deprives the sufferer of enjoyment but also saps their will to take action. The more inert the depression becomes, the more his melancholy worsens. Hamlet not only fails to take timely action throughout the play, but also hates himself for it. He sees Laertes and Fortinbras chomping at the bit to avenge their fathers, while he's messing around doctoring screenplays and forging letters. Had he been more direct and decisive, he could have gotten justice for his father while preventing a number of innocent deaths, including his own.