How does Hamlet excuse his actions during the play to Laertes in Act 5, Scene 2?
Prior to the fencing match that becomes Hamlet entrance into death he feels it necessary to tell Laertes that he understands Laertes' need to fight Hamlet, because Hamlet has wronged Laertes by murdering his father Polonius (by accident). Hamlet wants Laertes to know that the murder was not done for malicious purposes, but rather because he, Hamlet is mad. He blames the murder on his own madness in his seek for revenge for his own father's death.
"Then Hamlet does it not; Hamlet denies it. Who does it then? His madness." Lines 250-251
He basically apologizes for how he has hurt Laertes, but agrees to the fight anyway because he is using it as his means to murder Claudius to exact his revenge.
Hamlet, in Act 5, sc. 2, around lines 213-231, says that it was his mental illness that caused him to do and say the things that he did and said. Hamlet asks for Laertes forgiveness saying that he, Hamlet, can not really be held accountable when he was not in control of him faculties. Hamlet isn't really saying that he was mad, but that he has been so wrapped up in problems and distress that his thinking has not been straight.