As Sun Tzu said: attacking a fortified place is the last thing one should do. Attack another place that is so important that it must be protected, and annihilate the enemy when he comes out.
In Europe, it was common for besiegers to allow the garrison to leave in peace in exchange for turning over the castle. In one memorable instance, the besiegers refused to do this, but allowed the women to leave the castle with 'what they can carry.' So the women carried the men out.
If you want to attack a castle, you look for a weak point. In one instance a castle was stormed after the attackers climbed up the toilet shaft. In another case, a portion of the castle walls were incomplete, so the besiegers made a diversionary attack on a different place, and showed up at the low spot in the middle of the night, every soldier with a sandbag. They then built up a big ramp lickety split and stormed the castle. Another instance had the besiegers lay siege to a town, only to give up. The villagers left to gather firewood and other supplies that had been depleted during the siege, only to find the enemy was hiding in the woods.
The Romance of the Three Kingdoms is the best book to read for medieval military tactics.