You may not want to put yourself in this risky predicament for the sake of practice. But if you remember this tip, you can do the right thing when it happens for real.
Uh oh! You're suddenly bumping along the shoulder beside the right edge of the road. We guarantee -- your first instinct will be to immediately steer back on. Resist it!
Hold your line. Slide back on the saddle. Pedal steadily, or level your crankarms and crouch like a jockey if it's rough.
Check the pavement lip. If it's prominent, steering across it could easily catch a wheel and cause a spill.
Look for a safe "on ramp." Maybe the road and shoulder return to the same level just ahead. You need only a short section. Or maybe there's an intersecting road or driveway coming.
At the same time, listen and glance back for overtaking vehicles. Don't do anything until traffic is clear.
When you can, steer back onto the road. If the edge is still a bit higher than the shoulder, pull up on the handlebar to lift the front wheel across. The rear wheel will bump, but that's OK. It's not the one that determines control.
If you're adept at jumping your bike over potholes and other small problems, you could use the same technique here. Hop a few inches to the side so both wheels land on the road. You'd better practice this in an empty parking lot, jumping across painted lines rather than real road edges.
The main thing is not to automatically steer back to the road as suddenly as you slipped off. Stay cool. Size things up. And if you don't like what you see, brake to a stop and live to fight another day.