In Act 5, Scene 1, two Clowns (peasants) are discussing life and death as they dig Ophelia's grave. One Clown exits and Hamlet and Horatio arrive. Shortly after, Claudius, Gertrude, Laertes, a priest, and attendants arrive with Ophelia's coffin. The priest declares that since Ophelia's death was probably suicide ("Her death was doubtful"), she would not have a proper Christian burial. Overcome with grief and anger, Laertes jumps into the grave to hold Ophelia one last time. Hamlet leaps into the grave, proclaiming his love for Ophelia as well. This is the context of the quote:
Forty thousand brothers
Could not, with all their quantity of love,
Make up my sum (V.i.254-256)
Laertes is Ophelia's brother. Hamlet says that his love is greater, in sum, than forty thousand times Laertes' love for Ophelia. It is clear by this point that Laertes suspects Hamlet as his father's killer. And he, and others, have noticed that Hamlet had not lately been expressing his love for Ophelia (on account of his fake "madness"). And this accounts for Laertes' anger towards Hamlet in general. In their grief, Hamlet and Laertes are fighting over who loved Ophelia more.