Going off course includes jumping the fences in the wrong order, jumping a fence that is not part of the course, omitting a jump, etc.
If you are aware that you have gone off course:
Once you know that you are off course, you should stop jumping immediately and exit the ring promptly.
If you are not aware that you have gone off course:
At most shows, you will be asked by the announcer to leave the ring: "Rider in Ring _, you are excused." Once you have been told to leave the ring, you need to stop jumping immediately and exit the ring.
At some shows, you might be asked to leave by the in-gate person instead. In such as case, as soon as you hear the shouting from the in-gate, you need to stop your round.
As soon as the judge notices that you are off course, the bell will be rung repeatedly to indicate that you have been eliminated. Once the bell has been rung, you should not continue on course.
Going off course in the jumpers includes not crossing between the start timers and missing a mandatory turning point (generally seen on banks). Carefully checking the course diagram before the class can prevent some of these errors of course.
You can correct your deviation as long as you make a change before jumping the first wrong jump. Circling back or crossing your path when you notice that you are about to go off course will incur four faults but you will at least avoid being eliminated. Once you have taken a jump backwards or in the wrong order, no corrections can be made to avoid elimination.