If you have the opportunity to practice on the ultra course, take it! Being familiar with the course is a huge advantage. Not only do you learn the useful information like aid station locations and potential trouble spots, but you will be developing the running skills needed to tackle that specific race. You'll learn to run through the specific rocks, roots, mud holes, and hills that litter the course.
In the event you cannot run the same course, try to find a place to train that is as similar to the course as possible. Match up things like altitude, elevation change, surface (hard packed dirt, gravel, sand, rock, etc.)
I rarely had the opportunity to train on the course I was planning on running, but I did go to great lengths to find comparable trails. This usually involved scouring YouTube and Google Images for any visuals I could find. It also involved reading as many race reports as I could find.
Some variables are nearly impossible to experience, like altitude. When I trained for Western States (with a maximum altitude of 11,000 feet), I needed at way to simulate the lack of oxygen I'd experience. I lived in Michigan, which has an altitude of about 500 ft above sea level. The solution- I did several runs while breathing through a drinking straw from McDonald's. While I doubt it did anything physiologically, it did teach me a valuable lesson: there was a definite connection between available oxygen and pace. I quickly learned to be especially conservative and take frequent walk breaks. I also learned our local police department is suspicious of dudes running barefoot at night while breathing through a straw. What's weird about that?