Suicide affects the characters in many ways, although there is only one character whom it is agreed actually commits suicide: Ophelia. Of course, there is some question as to whether Gertrude knew the wine in the goblet was poisoned, and since Ophelia was in such a fragile state of mind, there's even a possibility that she didn't really commit suicide. Hamlet is a play of questions, and often, we come away with even more after reading. Let's begin with Ophelia though. Her death affects many characters, most strikingly her brother Laertes and Hamlet. When Gertrude enters with the news, Laertes is struck immediately.
Too much of water hast thou, poor Ophelia,
And therefore I forbid my tears; but yet
It is our trick; nature her custom holds,
Let shame say what it will. When these are gone,
The woman will be out. Adieu, my lord.(205)
I have a speech of fire, that fain would blaze
But that this folly drowns it.
So he refuses to cry, saying that Ophelia has had too much water already, & also saying that tears are womanly. He leaves in a distraught state, & Claudius is worried about him. Later, Laertes is upset to learn that because she killed herself, she won't receive a full ceremony. The priest says that ordinarily, she would be laid in unsanctified ground and would have glass and stones thrown at her. It is only due to her status that she is allowed any rites at all. Laertes responds, "Must there no more be done?" & the priest tells him that they would be doing a disservice to the dead to allow anything more. When Hamlet finds out that it is Ophelia being buried, He is as upset as Laertes, saying
I loved Ophelia. Forty thousand brothers
Could not, with all their quantity of love,
Make up my sum. What wilt thou do for her?
This leads to a graveside fight (some productions stage it as actually in the grave). This fight ultimately leads to the duel between Hamlet and Laertes, and the death of both characters.
Now, even though Ophelia is the character whose suicide is established, Hamlet ponders the concept in more than one soliloquy. In fact, it is those thoughts on life and death that guide his actions throughout the play. His first soliloquy, in Act I, scene 2 introduces this idea.
O, that this too too sullied flesh would melt,
Thaw and resolve itself into a dew,
Or that the Everlasting had not fix'd
His canon 'gainst self-slaughter! O God! God!
So, almost from the first moment we meet him, he is wishing for death. Yet it is a passive kind of wishing, from which nothing will really come. He returns to this idea in his most famous soliloquy, asking "To be or not to be." Again, he is questioning what is right: to be alive, or not to be alive.
Hamlet's notorious inaction is a direct result of this question, which becomes his central notion of being. Thus, although only one character commits suicide, the idea is a central motif in the play.