As strange as it sounds, broken spokes are actually fairly easy to fix in the wild. All you need is a spoke key.
(Touring riders often carry spare spokes and cassette removal tools, but that's getting a bit carried away for your general afternoon hills cruise.)
There are generally only two culprits: metal fatigue or catastrophic failure.
Metal fatigue is just regular wear and tear. Catastrophic failure, however, is due to an external force -- stick, rock, poorly adjusted rear derailleur, etc. -- going into the wheel.
For a metal fatigue situation (no accident, just the 'ping!' of the spoke breaking), assuming you only have one broken spoke, all you have to do is loosen the spokes on either side by a turn or two with your spoke key.
As you've released the tension in one location, this will cause a bit of an egg in the wheel, but as long as it's straight enough to miss the rear stays/fork legs/brake shoes, you should be able to get home.
(Just don't do any six-foot drops along the way.)
If you have multiple broken spokes, things should look pretty messy and we'd suggest that your ride is over, unfortunately. Can you get back to your car or phone someone to pick you up? If so, do that now. If, however, you need to get your bike working again to get home, read on.
Did something enter the wheel, or was it due to an accident? You'll want to be careful here: the wobbles may be due to random spoke tension (there will be several points with no tension at all) or a bent rim (usually from an impact, as sticks/rocks/derailleurs don't tend to bend a rim).
If something has entered the wheel, repeat the same method as for the single broken spoke: wherever you have a broken spoke, loosen the spokes either side until the rim is straight enough to get you back home.
If, however, the wheel has suffered a sideways force due to an accident and now looks like a potato chip, you're going to have to do some serious panel beating. This procedure generally takes great skill and patience, but if you're stuck in the middle of nowhere, you're going to have to give it a go. It's time to get courageous. And physical!
Firstly, loosen all spokes one full turn with your spoke key. This releases some of the stress off the rim.
Next, find the high spots by rotating the wheel. (They'll usually be directly opposite each other.)
Look for a stump/fence post/large rock that you can lean the wheel against while you force the rim straight again.
Put one low spot against the stump, etc. and the other on the ground.
Now push hard against the high spots so that you're actually going past the original "straight" point. (You have to reverse the damaging impact.)
Periodically check your progress by spinning the wheel to see how straight it is.
When you're happy enough, re-tension the spokes.
It won't be great, but hopefully will be good enough to get you home, and that's the main thing!
Once you're home, click here and we'll fix it up properly for you.