Multiple factors came together to demoralize the Qurayshi coalition and got them to retreat, ending the battle:
– Imam Ali’s victory over Amr ibn al-Wadd – Shortage of food and fodder. They had prepared for quick battle, not a month-long seige – A violent storm that trashed the Qurayshi camp – Distrust sown between the kuffar and the jews by a secret convert – Some Arabs deciding they’d rather be ruled by Arab than by Jews, even of those Arabs are Muslims
Podcast version: podcast.lifeofprophetmuhammad.com