In Act Two, scene two of Shakespeare's Hamlet, Hamlet's "What a piece of work is man" speech addresses his deep depression and heartache. Hamlet is a young man who has returned home from school for his father's funeral—an unexpected and tragic death. Much too soon after, his mother has remarried his uncle. Hamlet feels that Gertrude has too quickly forgotten his father, that she is inappropriate in the attention she shows her new husband (as if she were a young newlywed), and that his uncle/step-father is a loud, drunken and obnoxious man—a "satyr" compared to his loving and fine father, and noble King of Denmark.
Gertrude and Claudius want Hamlet to "get over" his father's death, even though it has been only a few months since Old Hamlet died. Old Hamlet's ghost (it seems) has appeared to Hamlet, demanding the son avenge the father's murder. (Hamlet struggles to find proof that the Ghost is truly his father's spirit.) Hamlet also suspects that Ophelia is spying on him. In essence, except for Horatio, Hamlet has lost the world in losing his father.
Rosencrantz and Guildenstern (his old school acquaintances) are certainly spying on Hamlet on Claudius' behalf—and Hamlet resents how these young men have turned against him and become his uncle's pawns. In the speech, though Hamlet may be trying to confuse Rosencrantz and Guildenstern or to figure out what they are up to, there is a deep truth in what Hamlet says to them. Hamlet's mind can rationally comprehend the beauty and majesty of mankind and the world, but it is his depression that robs him of the joy that beholding such beauty would bring under other circumstances:
…I have of late, (but wherefore
I know not) lost all my mirth, forgone all custom of exercises;
and indeed, it goes so heavily with my disposition… (287-289)
Hamlet has lost faith in most of the people in his world; he is lonely, misses his dad, is mourning his father's death, and is disappointed in the behavior of those around him—especially those he loves, specifically Gertrude and Ophelia. Hamlet finds Claudius' spies everywhere. But beyond this, I believe Hamlet is also trying desperately to make sense of the alien world in which he now finds himself.
His conflict arises from remembering the world as he once knew it, and trying to find a way to come to terms with the world as it is now: filled with lies, deceit and, potentially, his father's murder. We can infer that life with his father and mother was never as it has become!