A typical modern scenario of the medieval siege was the throwing of oil on the attackers from ramparts. Oil was really expensive so why waste it on attackers? Most commonly the items thrown were boiled sewage, rocks, and arrows. Does anyone know of any primal source of evidence of boiling oil being used as a weapon in sieges?
Like this thread on catapulting diseased dead bodies, the pouring of boiling oil and tar did happen - though not so commonly. Remember that many castles never saw action. Many more castles were built decoratively as a fashion rather than because defence was needed. However, when you look to city wall and city gates, here you see more use. Also a city will have the resources to summon up even expensive weapons if really needed.
One clear example I can find is in the crusaders attack on Jerusalem on July 1099, oil and Greek fire (thought to be oil based) was employed by the defenders. Mangonels, rams and siege towers had been moved into position beneath the gate of the city. These were set alight by the defenders using oil and burning arrows. Several books mention that the wall climbers were scalded by oil.
Basically, when you are under attack for your life, you will through everything you have down the murder holes or over the wall. Stones, arrows, burning wood, and if you have to, the oil. Even though it might be expensive - it's cheaper than loosing your life should the city fall.
Boiling oil is a good weapon, because its boiling point (400 degrees Fahrenheit) is much higher than that of water (212 degrees).
It was a moderately effective weapon against men. But by its boiling and burning properties, it was a very effective weapon against ladders, rams, catapults, and other war instruments made of wood. Also, if successfully used, it would cause a horrible death by burning. As such, killing ten enemy soldiers with oil had more of a "deterrent" effect than killing the same number by sword.
Because it was expensive, a garrison would not base its plans on using oil. But they used oil for other things like cooking, which is to say, that it could also be used to "cook" their enemies. When one is under attack, one uses what weapons one has at hand and worries about the consequences later.
An attack on the citadel was basically the last day of the battle. Either the defenders would win, in which case they could exit the place and replenish their supplies of oil, or they would lose, in which case they'd be slaughtered. Either way, saving oil for "after the battle" didn't make sense.