Why In history would armies dally fourth and fight outside your walls?
There can be a number of reasons why an army might attempt to march forth and break a siege. First of all, if you controlled a large enough castle, sallying out of one part of the fortifications could put you against a fraction of the forces who might be engaged in siege operations on in other areas of the Castle.
This happened in Antioch during the 1st Crusade. Following the discovery of the 'Holy Lance' by Peter Bartholomew (which is a discussion in and of itself) the Crusader army was motivated with the zeal of having a holy relic in their midst. To them, they simply could not lose.
Instead of trying to wait out a siege with no hope of relief, the defenders marched out of the gate. Good organization on the Crusader part, and dissension in the ranks of the Saracen army, worked in their favor. Despite taking massive casualties, the sheer tenacity of the march inspired fear and uncertainty. Men not committed to the fight fled instead of facing the crusading army, and those who were caught in combat began to panic at learning reinforcements were not coming.
Exact, specific (non propoganda) details are always tricky to uncover, but this is the general description. I've read versions where the Turks committed everything but where killed anyway (unlikely in my opinion) and versions where the Turks suffered light casualties but did suffer a mass rout (more likely).
The Crusader sallied forth due to a mixture of zeal and desperation. As Sun Tzu said, if you completely surround an enemy you will only strengthen his will to fight. Give the illusion of escape, and he will flee. In a siege there is no illusion of escaping.
There are other, secular, reasons for sallying forth.
In Richard I youth, he was sent to the Aquitaine to pacify a group of troublesome nobles who were rebelling against Henry II's rule. Richard's military campaign's crowning jewel was the siege of Taillebourg in 1179
Taillebourg was built into a rocky outcrop, and considered one of the most easily defensible fortresses of its time. Richard knew this, and already being a budding genius at siege warfare, knew that going over or through the walls was not an option. Three of the fortresses walls were protected from approach by the rocky and steep terrain, while the one and only approach was heavily defended.
21 years old at the time, Richard ordered his engines to begin battering the walls with stones while he sent a large portion of his army around to the villages and farms, burning, killing and plundering them as they went.
After seven days of watching their homes and sources of income destroyed, the defenders attacked, believing that Richard had left too few men at the siege to repel their advance. In my opinion, this probably was not intended to completely break the siege, but kill many defenders while the rest were looting and raping.
Too bad for them this was exactly what Richard had planned for, and Richard threw himself into melee combat. From my understanding of this, his actions inspired his troops to redouble their efforts, which might have ultimately saved the day
After intense fighting, Richard's forces managed to push the defenders back inside the castle. Now at full strength, Richard's army occupied all but the central citadel, which capitulated three days later.
Despite its failure, the sally forth at the siege of Taillebourg was a decent idea, it was just unfortunate for them that it was predicted. Richard played off the pride and emotion of the commanders of the city garrison, and it worked.
I've recommended Thomas Asbridge's "The Crusades; and Authorative History on the War for the Holy Land" before. It's a solid reading, and provides insight into both sides of the crusades (that is, Christian and Muslim.)
John Gillingham wrote a very excellent biography on Richard I, aptly titled 'Richard I'. It focuses on his reputation as a Crusader, of course, but also devotes a lot of pages to his childhood and young adulthood, highlighting many of his accomplishments, such as Taillebourg