In Hamlet's soliloquy in Act 1, Scene 5, what literary devices are used, and what purpose do they serve (e.g. how do they shape Hamlet as a character)?
Let's try for three distinct, substantial literary devices used in the 1.5 soliloquy of Hamlet.
Irony: Irony is the most prominent literary device in Hamlet's soliloquy in 1.5. Obviously "irony" is a common word, and in common usage it's taken on a more general and complex meaning than it has in strict literary analysis. To keep things rigorous, we'll go with Merriam-Webster, definition 3(a): "incongruity between the actual result of a sequence of events and the normal or expected result; an event or result marked by such incongruity."
Hamlet begins, using apostrophe (addressing something that is absent or inhuman as though it could respond) when he speaks to his heart and his muscles. He says, "Hold, hold, my heart, / And you, my sinews, grow not instant old, / But bear me stiffly up" (1.5.93-96). Because he's essentially imploring his body to remain young and strong and capable of doing that with which he's been charged by his father, this is also an example of synecdoche (the substitution of a part for the whole). He doesn't just want his heart and muscles to remain strong; he wants his entire body to bear up under this burden.
Further, Hamlet uses a metaphor to compare his brain to a table, a table from which he will "wipe away all trivial fond records." These "fond records" are any pieces of information Hamlet deems unimportant or that he retained from his education as a youth, which Hamlet wants to "wipe away" so he can focus solely on avenging his father's murder (1.5.100). He goes on to use another metaphor to compare his mind to a book, saying "thy commandment all alone shall live / Within the book and volume of my brain" (1.5.103-104). He means the only content of his mind will consist of his duty to exact revenge on his father's murderer, as his father's ghost commanded.
One thing I notice about these devices is that they all apply to Hamlet's mind and body. Also, they all only focus on Hamlet's need to remember what his father has said. He makes no mention of how he intends to plan or act or move forward. He doesn't compare Claudius to an evil snake like his father did. He doesn't describe his sword as an extension of his arm or anything that even sounds remotely like taking revenge. He only describes his need to internalize and recall his duty, but says nothing about how he intends to fulfill it. This combination of overthinking and inaction will characterize his behavior for the remainder of the play.