Kingdom of Heaven, Robin hood, Braveheart, the list goes on and on, the castles always fall, but did that actually happen in real life?
You would probably be interested in reading about the Siege of Candia, which was just an utterly bizarre siege that lasted a ridiculously long time.
But to address your questions more directly: a siege, barring external events (relief forces, unusually widespread disease, marked changes in weather patterns) would always be successful. A besieged force is almost always outnumbered, frequently outgunned, and usually subject to the aggressor's whims. Castles aren't supposed to be invulnerable. The investment necessary to make them invulnerable (in terms of construction, preparation, and the costs to garrison and maintain them) is simply astronomical and utterly unsustainable. And even the best-held fortification can still be captured by bribery, if absolutely nothing else works. Plus when it comes time to retake the place, you have to overcome whatever defenses are still intact. The walls you built could very easily keep you out.
So if the things were almost always going to fall to a determined enemy, why bother?
Simply put, castles and fortified cities were more about time. It took time to besiege a castle. After a siege was over, it then took time to reorganize the army (possibly breaking down siege engines), leave a garrison, secure the supply line, and move on. If the enemy didn't capture your castles, you could harry their supply line and cause all sorts of damage. As a result, leaving uncaptured castles and cities in your rear was generally a terrible idea.
The time it took the enemy to whittle away at your fortifications gave you time to do other things. If you were caught unprepared, it gave you time to raise and prepare an army. If your army was out on an expedition of some sort when the other guy attacked, it gave you time to pull your forces back (which could itself be a long and involved process). If you wanted to, you could even try to drive into the enemy's heartland and force them to abandon their push by threatening them more than they threatened you. The fortifications gave you strategic options and also prevented an enemy from just marching directly to your capital or whatever.
There's also the matter of other costs. Taking castles is expensive. Not only are you forced to feed and maintain all your troops in the field (which is itself expensive, especially with longer supply lines), you're going to be burning through supplies at an accelerated rate in sieges. An army, whether on the march or besieging a castle, needs to eat. But that same army is going to use a lot more arrows, stones, and bandages in a siege than it will on the march. All of these things translate into financial burdens. In an era where deficit spending (see modern government budges) was sketchy at best, forcing the enemy to empty his war treasury was an eminently viable strategy. Especially since those castles he's busy attacking are probably being maintained by your local lords, not your central treasury.
A good example of some of this in action is the campaign surrounding the Battle of Agincourt during the Hundred Years' War. At the beginning of the campaign, the English landed on the Seine and immediately set to besieging the port city of Harfleur. The siege lasted for about a month and, when it was done, the English had been hard-hit by disease. In the time it took them to capture the port, the French mustered for a counter-attack and successfully chased the English down. This forced the Battle of Agincourt.
While the English won that battle rather decisively, they had lost roughly a quarter of their original number by the time the battle broke out (they had to garrison Harfleur and a fair number of men were simply too ill [or too dead] to continue on the campaign, costing them something like two thousand men overall). Although things ultimately went very poorly for France in 1415, a relatively unimportant port city managed to pull away a quarter of the English army from the campaign. Other campaigns would feature this kind of thing on a smaller scale but that particular campaign certainly illustrates the strategic value of using fortifications to whittle the enemy down.
Siege of Malbork (Marienburg) castle, which belonged to Teutonic Order, by Polish-Lithuanian Commonwealth, in 1410, lasted two months and ended up with PLC withdrawing their forces. Castle had enough stockpiles to last 2 years and Commonwealth army lacked enough siege machines to take fortress as big (It was biggest castle in Europe). They tried again in 1454, and failed as well ( due to spread of plague and low morale, following loss at different siege attempt - Konitz/Chojnice ). Poland ended up "buying" the castle from Bohemian mercenary Oldřich Červonka, for 190,000 Hungarian florens ( ~660kg of gold), who was administering it, as the Order wasn't paying him agreed fee, in 1457. Teutonic Order tried to re-capture it in siege in the same year, but failed as well. Fortress stood undefeated until 1656, when Swedish forces won it, after a month-long siege.
Who won, beseiger or beseiged, depended on numerous factors. If the city had stockpiles of food and access to sufficient water that couldn't be tampered with, or better yet, a protected port to ship in supplies, they could in some cases withstand an army until its forage, money, and morale were exhausted. Case in point, while the outcome is in fact unclear, Jerusalem was able to withstand an Assyrian seige of 701 BC under Sennacherib, who makes no claim to have captured the city. The Judahites fortified the city and cut a tunnel through living rock to the spring of Gihon to keep the city supplied with fresh water. The overextended Assyrian army seemingly withdrew (or was perhaps paid off). Both sides' accounts are known to be self-aggrandizing and there is no third, objective source, but the city in any case seems to have withstood. The solution of lifting a seige by payment of tribute has been mentioned as being used several times by Phoenician cities.
Masada, an Israelite fortress, was able to withstand a Roman siege for several months in the 70s AD. Tyre, then on an island, withstood Alexander's assault for seven months as well.
Sometimes cities hoped they need hold out only until reinforcements arrived to drive off the beseiger, but this of course could also fail. Caesar beseiged the Gallic town of Alesia for some weeks while the residents held out waiting for a grand army to arrive and drive him off. Despite simultaneously attacking Caesar's circumvallation from the city and from without with vastly superior numbers, however, the Gauls could not secure a victory over Caesar's disciplined, experienced army in its well-fortified position.
Demetrius, son of one of Alexander's generals, failed to take Rhodes after a yearlong seige. This despite employing hundreds of ships and grand seige equipment that he used so often he earned the nickname Poliorcetes, or "Beseiger of Cities".
I believe that more often, a city would eventually be taken, either by force, starvation, disease, lack of water. Except by payment of tribute or indemnity, seiges seem to have been lifted only rarely.