In the earliest days of railroading, train movements were controlled by flagmen, station agents, or other workers alongside the tracks, using flag or lantern signals to stop or start trains as needed.
The first practical mechanical wayside signals, developed in the mid-1800's, used large colored balls manually moved up or down a tall pole with a rope. A ball at the top of the pole meant "clear to proceed" (even today, railroaders refer to a signal to proceed as a "highball," one of many railroad terms that entered general use).
Manually operated semaphore signals soon followed, using the position of a brightly-painted wooden blade to convey "stop," "slow," or "proceed" orders. Though an improvement, all manual signals remained prone to human error. The development of the electric track circuit in the early 1870's allowed signals to be controlled automatically, greatly reducing the chance for mistaken signals and the possibility of collisions.