Summary: Samson travelled to Gaza where he consorted with a harlot after which tore out the city gates. He met a woman called Delilah who was employed by the Philistine leaders to discover the source of his strength. After three failed attempts, Delilah eventually coaxed the truth out of Samson that due to his Nazirite oath, his hair had never been cut. She lulled him to sleep so the Philistine men could shave his head. When he awoke, they overpowered him and gouged out his eyes before throwing him into prison.
A deeper look: Rabbi David Kimchi (d. 1235) notes that unlike every other judge, the period that Samson judged is recorded at the peak of his life, rather than at the end (Judges 15:20). He explains that this chapter now marks the downfall of Samson as he indulges his passions. The Gemara explains that since he sinned in Gaza he was punished there too, measure for measure; he sinned with his eyes by gazing at beautiful women and surrendered to temptation, so his eyes were gouged out by the Philistines (Sotah 9b).
Rashi (d. 1105) explains that verse in the Shema ‘and you shall not wander after your hearts and after your eyes’ (Numbers 15:39) highlights the process of human temptation; ‘the eye sees, the heart desires and the body commits the transgression’.
In the end, the Philistines wanted to humiliate Samson. They praised their idols for delivering him to them and Samson cried out to God to restore his strength one last time to avenge God and punish the Philistines for this desecration of God’s name. God answered his prayer allowing him one last burst of strength which broke the supporting pillars and brought down the building, killing everyone inside.
While suicide is forbidden Jewish law, Samson’s actions were contingent on God’s miraculous intervention. Given the desecration of God’s name caused by the Philistines Samson was permitted to risk his life to sanctify God’s name. This also demonstrated his desire to undo the damage he had caused by giving in to temptation. He may have completed his mission but it had now cost him his life.