Written at a time of religious upheaval, and in the wake of the English Reformation, the play is alternately Catholic (or piously medieval) and Protestant (or consciously modern). The Ghost describes himself as being in purgatory, and as dying without last rites. This and Ophelia's burial ceremony, which is characteristically Catholic, make up most of the play's Catholic connections. Some scholars have observed that revenge tragedies come from traditionally Catholic countries, such as Spain and Italy; and they present a contradiction, since according to Catholic doctrine the strongest duty is to God and family. Hamlet's conundrum, then, is whether to avenge his father and kill Claudius, or to leave the vengeance to God, as his religion requires.
Much of the play's Protestantism derives from its location in Denmark—both then and now a predominantly Protestant country, though it is unclear whether the fictional Denmark of the play is intended to mirror this fact. The play does mention Wittenberg, where Hamlet, Horatio, and Rosencrantz and Guildenstern attend university, and where Martin Luther first proposed his 95 theses in 1517, effectively ushering in the Protestant Reformation. In Shakespeare's day Denmark, like the majority of Scandinavia, was Lutheran.
Hamlet is often perceived as a philosophical character, expounding ideas that are now described as relativist, existentialist, and sceptical. For example, he expresses a subjectivistic idea when he says to Rosencrantz: "there is nothing either good or bad, but thinking makes it so". The idea that nothing is real except in the mind of the individual finds its roots in the Greek Sophists, who argued that since nothing can be perceived except through the senses—and since all individuals sense, and therefore perceive things differently—there is no absolute truth, only relative truth. The clearest alleged instance of existentialism is in the "to be, or not to be" speech, where Hamlet is thought by some to use "being" to allude to life and action, and "not being" to death and inaction.
Hamlet reflects the contemporary scepticism promoted by the French Renaissance humanist, Montaigne. Prior to Montaigne's time, humanists such as Pico della Mirandola had argued that man was God's greatest creation, made in God's image and able to choose his own nature, but this view was subsequently challenged in Michel de Montaigne's Essais of 1580. Hamlet's "What a piece of work is a man" could supposedly echo many of Montaigne's ideas, and many scholars have disagreed whether Shakespeare drew directly from Montaigne or whether both men were simply reacting similarly to the spirit of the times.
Nevertheless, if the sentence is analysed in the textual context  it is easy to understand how Hamlet was being sarcastic: "Man delights not me", he concludes. Amaral  argues that this is the result of melancholy. This condition was a main subject of philosophy on this epoch. After a period of confidence on reason to unveil reality (Renaissance), 'Mannerism' started questioning its power. Hamlet shows traces of this. In this sense, Hamlet is not feigning madness, but he is indeed trapped between the world everybody expect him to see (the lies told by Claudius and accepted by all, i.e. social decorum) and the world revealed to him by knowledge (the reality of the murdering, as testified by his father's ghost). This condition of being trapped between two different ways of seeing reality was also pictured by Shakespeare's contemporary Cervantes, in Don Quixote. This profound meditation was examined by the philosopher Arthur Schopenhauer in The World as Will and Representation. Schopenhauer uses Hamlet to clarify his main argument. He argues that the world as we see is a conjunction of representations. These representations are formed by the projection of our will towards the world. We can only see objects of our desires. In this sense he argues that only art could show us that reality is such a construct. Exactly as Hamlet did: "If the whole world as representation is only the visibility of the will, then art is the elucidation of this visibility, the camera obscura which shows the objects more purely, and enables us to survey and comprehend them better. It is the play within the play, the stage on the stage in Hamlet." 
In his openness to embrace the message of the ghost, Hamlet assuages Horatio's wonderment with the analytical assertion, "There are more things in heaven and earth, Horatio, than are dreamt of in your philosophy."
In the first half of the 20th century, when psychoanalysis was at the height of its influence, its concepts were applied to Hamlet, notably by Sigmund Freud, Ernest Jones, and Jacques Lacan, and these studies influenced theatrical productions. In his The Interpretation of Dreams (1900), Freud's analysis starts from the premise that "the play is built up on Hamlet's hesitations over fulfilling the task of revenge that is assigned to him; but its text offers no reasons or motives for these hesitations". After reviewing various literary theories, Freud concludes that Hamlet has an "Oedipal desire for his mother and the subsequent guilt [is] preventing him from murdering the man [Claudius] who has done what he unconsciously wanted to do". Confronted with his repressed desires, Hamlet realises that "he himself is literally no better than the sinner whom he is to punish". Freud suggests that Hamlet's apparent "distaste for sexuality"—articulated in his "nunnery" conversation with Ophelia—accords with this interpretation. This "distaste for sexuality" has sparked theories of Hamlet being what is now referred to as a homosexual or asexual. John Barrymore's long-running 1922 performance in New York, directed by Thomas Hopkins, "broke new ground in its Freudian approach to character", in keeping with the post-World War I rebellion against everything Victorian. He had a "blunter intention" than presenting the genteel, sweet prince of 19th-century tradition, imbuing his character with virility and lust.
Beginning in 1910, with the publication of "The Oedipus-Complex as An Explanation of Hamlet's Mystery: Study in Motive," Ernest Jones—a psychoanalyst and Freud's biographer—developed Freud's ideas into a series of essays that culminated in his book Hamlet and Oedipus (1949). Influenced by Jones's psychoanalytic approach, several productions have portrayed the "closet scene", where Hamlet confronts his mother in her private quarters, in a sexual light. In this reading, Hamlet is disgusted by his mother's "incestuous" relationship with Claudius while simultaneously fearful of killing him, as this would clear Hamlet's path to his mother's bed. Ophelia's madness after her father's death may also be read through the Freudian lens: as a reaction to the death of her hoped-for lover, her father. She is overwhelmed by having her unfulfilled love for him so abruptly terminated and drifts into the oblivion of insanity. In 1937, Tyrone Guthrie directed Laurence Olivier in a Jones-inspired Hamlet at The Old Vic. Olivier later used some of these same ideas in his 1948 film version of the play.
In the 1950s, Lacan's structuralist theories about Hamlet were first presented in a series of seminars given in Paris and later published in "Desire and the Interpretation of Desire in Hamlet". Lacan postulated that the human psyche is determined by structures of language and that the linguistic structures of Hamlet shed light on human desire. His point of departure is Freud's Oedipal theories, and the central theme of mourning that runs through Hamlet. In Lacan's analysis, Hamlet unconsciously assumes the role of phallus—the cause of his inaction—and is increasingly distanced from reality "by mourning, fantasy, narcissism and psychosis", which create holes (or lack (manque)) in the real, imaginary, and symbolic aspects of his psyche. Lacan's theories influenced literary criticism of Hamlet because of his alternative vision of the play and his use of semantics to explore the play's psychological landscape.
In Bloom's Shakespeare Through the Ages volume on Hamlet, Harold Bloom expressed his conviction that the intentions of Shakespeare in portraying the character of Hamlet in the play exceeded the capacity of the Freudian Oedipus complex to completely encompass the extent of characteristics depicted in Hamlet throughout the tragedy. As Bloom stated in this volume; "For once, Freud regressed in attempting to fasten the Oedipus Complex upon Hamlet: it will not stick, and merely showed that Freud did better than T.S. Eliot, who preferred Coriolanus to Hamlet, or so he said. Who can believe Eliot, when he exposes his own Hamlet Complex by declaring the play to be an aesthetic failure? James Joyce did far better in the Library Scene of Ulysses, where Stephen marvelously credits Shakespeare, in this play, with universal fatherhood while accurately implying that Hamlet is fatherless, thus opening a pragmatic gap between Shakespeare and Hamlet."
In his book Hamlet Made Simple (2013) David P. Gontar turns the tables on the psychoanalysts by suggesting that Claudius is not a symbolic father figure but actually Prince Hamlet's biological father. The hesitation in killing Claudius results from an unwillingness on Hamlet's part to slay his real father. If Hamlet is the biological son of Claudius, that explains many things. Hamlet doesn't become King of Denmark on the occasion of the King's death inasmuch as it is an open secret in court that he is Claudius' biological son, and as such he is merely a court bastard not in the line of succession. He is angry with his mother because of her long standing affair with a man Hamlet hates, and Hamlet must face the fact that he has been sired by the man he loathes. That point overturns T.S. Eliot's complaint that the play is a failure for not furnishing an "objective correlative" to account for Hamlet's rage at his mother. Assume that Hamlet is not who he seems to be and the objective correlative becomes apparent. Hamlet is suicidal in the first soliloquy not because his mother quickly remarries but because of her adulterous affair with the despised Claudius which makes Hamlet his son. Finally, the Ghost's confirmation of Hamlet's Sr.'s fatherhood is a fabrication designed to give the Prince a motive for revenge.
In the 20th century, feminist critics opened up new approaches to Gertrude and Ophelia. New Historicist and cultural materialist critics examined the play in its historical context, attempting to piece together its original cultural environment. They focused on the gender system of early modern England, pointing to the common trinity of maid, wife, or widow, with whores outside of that stereotype. In this analysis, the essence of Hamlet is the central character's changed perception of his mother as a whore because of her failure to remain faithful to Old Hamlet. In consequence, Hamlet loses his faith in all women, treating Ophelia as if she too were a whore and dishonest with Hamlet. Ophelia, by some critics, can be seen as honest and fair; however, it is virtually impossible to link these two traits, since 'fairness' is an outward trait, while 'honesty' is an inward trait.
Carolyn Heilbrun's 1957 essay "The Character of Hamlet's Mother" defends Gertrude, arguing that the text never hints that Gertrude knew of Claudius poisoning King Hamlet. This analysis has been praised by many feminist critics, combating what is, by Heilbrun's argument, centuries' worth of misinterpretation. By this account, Gertrude's worst crime is of pragmatically marrying her brother-in-law in order to avoid a power vacuum. This is borne out by the fact that King Hamlet's ghost tells Hamlet to leave Gertrude out of Hamlet's revenge, to leave her to heaven, an arbitrary mercy to grant to a conspirator to murder. This view has not been without objection from some critics.
Ophelia has also been defended by feminist critics, most notably Elaine Showalter. Ophelia is surrounded by powerful men: her father, brother, and Hamlet. All three disappear: Laertes leaves, Hamlet abandons her, and Polonius dies. Conventional theories had argued that without these three powerful men making decisions for her, Ophelia is driven into madness. Feminist theorists argue that she goes mad with guilt because, when Hamlet kills her father, he has fulfilled her sexual desire to have Hamlet kill her father so they can be together. Showalter points out that Ophelia has become the symbol of the distraught and hysterical woman in modern culture.