Going into a session, I only have a vague idea where the skill challenges will occur or what they will be about.
I would say I have about the same idea as I do about combat encounters - that is, I have some general ideas for situations/encounters that I'm expecting to run, but how they play out and what the players do with them is up to the players.
Just in my last session I had statted up the wererats who had taken over a former temple of Erathis that the PCs wanted to repossess. The players decided to have their PCs bring a legal action rather than exercising self-help. That was resolved as a quick complexity 1 (4/3) skill challenge.
It was pretty clear that the PCs would win the court case - they'd already undertaken legal research, and the wizard/invoker had rolled 44 for the History check to draft the pleadings - but resolving the challenge was still quite interesting. The players had to make some choices about how their PCs argued the matter, and there was one failure (maybe 2? I can't remember) resulting in an interesting complication - the Patriach of Bahamut hearing the matter decided to set aside the transfer of title to the wererats (on grounds that the Baronial advisor who had authorised it was a traitor at the time, and therefore his administrative actions were legal nullities) - which was what the players and their PCs wanted - but he also explained his reasoning in these terms, that he was sure the Baron would not have agreed to the transfer, had he known that his advisor was duping him, and was in fact a traitor building up a subversive nest of wererats.
Given that there was already an undercurrent of power struggle between Baron and Patriarch in which the PCs have been caught up, and give that the Baron is currently in a state of collapse from nervous exhaustion, and given that at least until now the PCs have been more closely associated with the Baron than the Patriarch, this way of framing the resolution of the legal matter had political implications that they didn't like.
This is part of the point, as I see it, of a resolution structure. Because it obliges the fiction to be extended beyond a simple "Yep, you win the court case", it creates a space into which complications can be inserted, in which the players can exhibit their concerns and have those concerns responded to within the fiction, etc.
If the party has to infiltrate a costume ball at a noble's mansion I'd not frame that as a skill challenge, but simply let the players act out their plan, and see if it succeeds, reacting to every action according to its outcome.
<snip>
How many different tasks they need to complete is something even the GM cannot say in advance so how could he/she set a given number of successes in advance?
Well, part of the logic of an extended contest mechanic is that you (the GM) have already decided, in advance, about how much heft this is going to have in the course of play, and you narrate the outcomes of successful checks in a fashion that is consistent with that. That's part of the idea of using metagame considerations to shape the adjudication.
So if the costume ball is being run as a 6/3 challenge, bribing the major domo might be run as a single check leading (on success) straight into the ballroom, and on a failure to him insisting on a larger amount of money (or, perhaps agreeing, but warning his employer to be on the lookout for these suspicious characters). Whereas if it's being run as a 12/3 challenge, then bribing the major domo might itself be played out as a mini-scene.
Upthread, [MENTION=87792]Neonchameleon[/MENTION] said he doesn't tell his players when they're in a skill challenge. I often do let them know, and give them a general indication of how serious it is (much as one might in a combat, letting them know how many foes there are, how big they look, when they are bloodied etc). This is because I think the players have to have at least some indication as to how many resources they need to devote - a 12/3 challenge is probably going to require more resources to be consumed for success than a 6/3 challenge.
If you can leave a SC early you don't need the framework at all, but can stick to individual tasks and encounters.
I'm not sure why this would follow.
The PCs can abandon their efforts in combat, lie down and let the enemies slaughter them. It doesn't follow from this being a possibility that there is no need for the combat resolution mechanism.
So, likewise, if the PCs abandon their efforts in a skill challenge, they fail to get whatever they were hoping to achieve.