Circuitron sells two different auto reverse boards you can wire up to any layout. You simple use a trigger at each end of the track. When the train trips the trigger it stops, waits, then reverses.
If you use DCC, you can check out the bit-switch, which allows dcc trains to make scheduled stops, reverse, etc (automatically).