There are two parts to this: Emergency recovery, and fixing of the cause.
Emergency recovery
This is already described this in iled's answer. I'll just repeat for clarity:
- Get off the bike and stand on the side of the chain.
- Grab the upper part of the chain right in front of sprocket and pull it away from the rear wheel if it's between sprocket and wheel. If the chain has fallen to the other side, you need to push it towards the wheel.
- Move your bike back to let the sprocket grab the chain. Make sure that the chain makes the transition smoothly enough, otherwise you may damage chain and/or sprocket due to over-tension.
- Once your sprocket has firmly caught the chain, continue moving backwards so that the chains sits correctly all around the sprocket. That means, you must turn the sprocket more than a full half turn. If you forget this step, the chain will be back off the sprocket immediately.
Fixing the cause
When a single speed chain falls off the sprocket, that's usually down to one of two reasons:
Your sprocket has lost teeth.
Otherwise, a jumped chain is a sure sign of the chain having too much slack.
The first case is obvious to diagnose. Just look for missing teeth, and replace the sprocket if some are missing. If you find none, you need to readjust the rear wheel for correct chain tension:
- Loosen the nuts that hold your hub's axle in the dropouts of your frame. You don't need to unscrew them, you just need to loosen them enough so that you can easily move your back wheel in the dropouts.
- Pull the rear wheel back until the chain has the correct tension. That does not mean that the chain should have no slack, but that the slack should be relatively limited. Try to get as little slack as possible while being able to turn the cranks without any significant resistance. If the tension is too high, you get unnecessary wear and loose pedaling power, if the tension is too little, you get jumping chains.
- Retighten your hub's axle nuts. Take care to fasten your rear wheel in such a way that it is in-line with the frame. Also take care to apply enough torque: When you pedal with your full weight, your chain is pulling with roughly twice your body weight on the rear wheel, and the axle nuts have to withstand that force.