Where is the exposition located in the play Hamlet?
As in any stage play, the exposition in Hamlet has to be contained in the dialogue. The characters speak to each other and are conveying exposition (i.e., information) to the audience at the same time. In Shakespeare's play some of the exposition is conveyed in Hamlet's soliloquies. In these, Hamlet is usually telling himself about his feelings and thoughts. Here is an example:
I'll have these players
Play something like the murder of my father
Before mine uncle. I'll observe his looks;
I'll tent him to the quick. If he but blench,
I know my course. Act 2, Scene 2
In Act I, Shakespeare has to go to a lot of trouble to identify one actor as the ghost of Hamlet's father. Then the ghost will convey a great deal of essential information to Hamlet in his dialogue in Scenes 4 and 5. The audience will understand that Claudius killed his brother, married his brother's widow, and usurped his brother's crown; furthermore, Hamlet is now duty-bound to exact revenge. Shakespeare had to invent a ghost in order to convey all this weighty information to his audience, because only the ghost could know what actually happened.
When a play begins, the audience only sees actors on the stage. The actors have to be identified. In Hamlet, for example, much of Act 1 is devoted to introducing the characters. They typically do this by calling each other by name. Hopefully, the audience will remember who is who after awhile. The actors call each other by name much more frequently than is common with people in daily life. In Act 1, Scene 3 of Hamlet, for example, Shakespeare uses the dialogue to identify three important characters: Polonius, Ophelia, and Laertes. The author also establishes that Polonius is the father and that the other two are his children; and furthermore, Shakespeare establishes that Hamlet and Ophelia have a love relationship. Here are a few examples of how the characters address each other by name and how they convey exposition in dialogue.
Fear it, Ophelia, fear it, my dear sister
Yet here, Laertes? Aboard, aboard, for shame!
Farewell, Ophelia, and remember well
What I have said to you.
Polonius calls Laertes by name and also indicates in his subsequent dialogue that Laertes is leaving to study abroad. The cautions both Polonius and Laertes give Ophelia about being too intimate with Hamlet make this scene more dramatic than it otherwise would be.
There is usually more exposition through dialogue in the opening part of a stage play than later on when the audience can recognize the characters and understands what the main problems are. But you will find exposition throughout Hamlet and throughout most stage plays.
If a dramatist wants to avoid using soliloquies, he is pretty much forced to have at least two characters talking to each other. In Waiting for Godot, for example, Samuel Beckett creates a pair of principal characters, Vladimir and Estragon, primarily because he needs to have them talking to each other and at the same time tell the audience who they are, what they are doing there, etc. They are virtually identical, but Beckett cannot have one sole actor waiting for Godot unless the character would be talking to himself all the time.
In Our Town, an excellent and unusual play by Thornton Wilder, the dramatist uses a character called the Stage Manager as a narrator who delivers most of the exposition directly to the audience. The Stage Manager introduces the characters by their names, although the characters will sometimes address each other by name or by their relationship, such as "Mother."
It is interesting and instructive to look through a play like Hamlet and just identify the parts of the dialogue that are exposition and the places where the actors are addressing each other by names or relationships in order to convey that information to the audience. Every dramatist has to do these things, but some can do it more adroitly than others. The dialogue also has to characterize the speakers and do other things such as explaining what happened in the past.