As GMs, we fear failure. Not on our part - we're good with that - but when our players fail. We're well trained to handle success, to roll forward and turn it into play, but a failure can totally jam us up. It's unfun for the player and we're not always sure how to proceed. So with that in mind, here's another how to: How to handle failure.
First, the disclaimer.
So with that out of the way...
The rule of the dice is that when you roll the dice, something should happen. Ideally, you're already ready for both success and failure and you know what to do, but I'm assuming here that you don't. "Something Happens" shouldn't be too hard a test to past, but too often, a failure translates into nothing happens, and that's where things go wrong.
So first and foremost, if you can, make the failure active. Things break, disasters happen, and the manure hits the rotating blades. Things don't just not work, they go wrong, and in going wrong they demand response. It may seem counterintuitive, but the bigger and bolder you get with with the failure, the more your players will embrace it because it will give them things to do.
Now, that's great if you can make it happen, but not every failure is going to offer itself to that sort of outcome. Sometimes the action doesn't suggest a good, fun failure, or sometimes you're just going to draw a blank on how to bring that failure to life. In that case, fall back on this model: A failure is a success with an additional cost.
That is, the character succeeds, but it's not an unalloyed success. The character jumps the chasm but twists his ankle on the landing. The lock gets picked, but not before the guards see you. You search the room, but you damage the clue you find. You find the book you need, but it's in a language you don't know.
Between these two tricks you should have everything you need to handle a poorly timed failure.
1 - This is also an opportunity to respect your players by attributing flukey failure to things external to the character, If you character is good at something, you don't want the dice to tell you that you suck. Rather, if the failure has some external cause (missing information, a broken tool or the like) then the player's expertise is still respected, but things have gone wrong.
2 - This is also a great solution for situations which would traditionally be "Failure equals death" since those failures tend to really suck.