This is an interesting question, and it helps to understand what the id, ego and superego are. Freud stated that our id is our subconscious, animalistic desires. The id is our most barbaric, instinctual, base nature, the part of ourselves that wants to do things that aren't necessarily appropriate, moral or even decent. The superego is the opposite of that; it is the voice of society's rules, the moral voice, the super polite and rule-oriented voice of propriety. It is like a super-strict nanny that won't let you do anything. The ego is the middle ground; it is the medium between these two, and is constantly managing the extremes of the other and finding a good middle place that works. The ego takes information from both the id and the superego and decides which behaviors will most healthily blend the two.
In "Hamlet," a Freudian critic would indicate that Hamlet has several desires that are being driven by the id. He has a desire to just murder Claudius, right there, right then, and rant and rave at his mother. He might go into the Oedipus complex, another fun Freudian theory that states sons have a subconscious desire to be romantic with their mothers (icky, I know, but Freud claimed it happened), and try to point out that Hamlet is, in some twisted way, jealous of Claudius's relationship with his mother, and that is fueling his angst against her. Then, the critic would point out Hamlet's "to be or not to be" speech as evidence of his super-ego, his thinking, moral, principled mind, showing light and fighting his baser urges. The critic would point out Hamlet's reasons for not killing Claudius during prayers as a triumph of the super-ego: he can't kill Claudius while he is praying! That is evidence of the ordered, moral superego winning over.
All in all, a Freudian critic might assert that the entire play is a battle between Hamlet's id and superego. Each one is fighting for control in Hamlet's actions, and it isn't until he has reached a middle ground, with the help of the ego, that he is at peace, can declare "the readiness is all," and move forward with confidence to enact revenge. I hope that those thoughts help; it's a complex issue! Good luck!