Before you leave the floor, check your rope is long enough to get you back down again. It's advisable to tie a knot in the end of the rope (perhaps into the loop of a rope-bag)?
If you do find yourself on some 50m monster, the easiest way to get back down is usually to pull up a spare rope, tie this to the end of your lead rope and then abseil the whole length. Remember you'll first have to pull up the lead rope and drop it again as the knot tying the ropes together will not pass through the quickdraws. Also, remember to get your mate to tie on the abseil device that you forgot!
At some point you may be faced with two rusty bolts linked with old rope, dodgy threads, or even just a single old rusty bolt - probably home-made out of an old bicycle component!
If you don't have a spare rope the best option is to lower off in stages. Often routes are equipped for this with a mid-height lower-off that you can reach on the way down. Clip into it, untie the rope, pull it through and lower from this belay. Check the guidebook description and look out for these on the way up! If there is no mid-height lower-off it may be necessary to use bolts on the route itself.
Failing this, you can just opt to jump off onto the last bolt, then unclip that and drop onto the next and so on till you think you will make it to the ground. However, this is all very scary and doesn't do either your rope, or the bolts, any favours.
The lower off
Well-established sport routes generally have very nice lower-offs consisting of two good bolts linked with a sturdy chain and a fixed lowering karabiner ('krab') - simply clip and go! Note: if there are others to follow you, place and lower from your own kit in the belay to prevent wear to the lower off, some of the fixed karabiners at popular venues are becoming extremely thin!
In contrast to these 'luxury lower-off' you may well be faced (most likely in the UK) with two rusty bolts linked with old rope, dodgy threads, or even just a single old rusty bolt - probably home-made out of an old bicycle component! Trust your judgement and use common sense. Never be afraid to leave a krab behind; £4 is very cheap compared to a large hospital bill. Be wary of 'old tat' too, pull it through to see if it is worn anywhere.
Never lower directly off a piece of dodgy-looking equipment, even if it is new. You will not make it to the ground before your rope burns through it and snaps it. If there is only a single bolt and you suspect it is not strong enough, at least leave a krab in the last bolt before the belay (but bear in mind that if the belay does fail you may be going for a long fall!)
Check the belay before lowering on fixed gear!
Instead of karabiners, some belays have two large diameter staples or rings. In this case the anchor must be 'threaded'. This involves clipping yourself into the belay with a long sling or some spare quickdraws, untying the rope, passing the end through both staples and re-tying. Dropping the rope when untied is a distinctly bad plan, so pull up some extra rope, tie a knot in it and clip it somewhere bfore untying.
Note that if you certainly wouldn't lower-off on one bolt, then make sure that you are somehow connected to both bolts while you are hanging there fiddling around. Many people remove some of the potential errors by pulling up a bit of rope and passing it through the lower-off. The loop end is then tied into the harness with a bowline or figure eight, and a screwgate. The original knot is then untied. With this method you are never actually untied from the rope.
Most important of all, communicate with your belayer and let them know what's going on. After all, what does 'Okay' mean when you reach the belay? Don't be like one climber who sat back, expecting to be lowered gently, not knowing that his belayer had taken him off his harness! Of course, gravity pulled the climber down and the rope shot upwards with nothing to arrest its progress. Fortunately the grigri was still on the rope and snagged on the first quickdraw!