Just need one side to surrender to end a war.
A group like hamas cannot functionally surrender. Nor does it have any incentive to.
They are intransigent and will always chose violence over any other more reasonable option[1]. And take decades of concerted effort to stamp out. The Muslim Brotherhood still exists despite decades of efforts to suppress it.
[1] The sad thing is the road of violence is where the Palestinians are weakest. And the road of using shaming is where they are strongest.