First, consider your race's features. Is it mountainous? Flat and winding? Packed dirt or loose gravel? Your training plan should take into account factors such as altitude, overall elevation change, and course description, says ultra-marathoner Dean Karnazes. "It’s always best to try to experience what you’ll be encountering firsthand, at least a couple times," Karnazes says.
Ultra-marathoner and running coach Zach Bitter agrees. "If the trail is buffed out and doesn't have lots of quick sharp turns, you can get away with doing less actual trail work," he says. But if your race is technical, with sharp turns or tricky terrain, look your city's park system.
Most big cities have at least a few unpaved or winding trails nearby—New York City has Central, Prospect, and Van Cortland parks; Chicago has the Cook County Forest Preserve; and San Francisco has "miles and miles of nature trails and undeveloped wilderness" just over the Golden Gate Bridge, says Karnazes, a Bay-Area local.
When urban dirt trails aren't an option, try to add other types of varied terrain to your runs. Detours through grass, sand, or even cobblestone streets can strengthen ankle and foot muscles and help you prepare, physically and mentally, for the unexpected.
Practice on stairs, too. "Running up greatly improves leg strength and aerobic capacity," says Karnazes. "Also, run down the stairs at an accelerated pace, as this can help your footwork in tight spaces."
Incline treadmill training can also boost cardiovascular conditioning. But try to find some real hills (or a treadmill that also has a negative incline function), as well. "The eccentric contractions from running downhill is very hard to mimic outside of actually running downhill," says Bitter. "Training for uphill portions of trail can be much more easily mimicked through strength-building exercises."
As for those exercises, Bitter suggests lateral movement drills, core-strengthening moves, and plyometrics, which can help you keep your balance and reduce impact as your feet pound the uneven terrain. Some of his favorites: Romanian dead lifts, planks, sideways ducking under and stepping over hurdles, and lunges—front, back, and side.
You may also want a pair of trail running shoes—which have grippier treads than road shoes, and various features to protect against rocks, roots, and dirt—especially if your race includes slippery or unstable surfaces. Be sure to break them in; it's more important to do that than to worry about wearing down the tread on asphalt, or running in the "wrong" type of shoe.
Bottom line: "Just because you cannot perfectly train for an event doesn't mean you shouldn't do it—but do go into it with realistic goals." (Keep in mind: Well-trained or not, you'll almost always be slower on trail than on road.) And if your day-to-day life makes it difficult to access trails, plan your weekend recreation around it. You won't regret it on race day.