A low-voltage electric current is sent between the two rails via a series of relays like the ones in this photo. When a train approaches, the current runs through the train's metal wheels and axles instead of the relays. This short circuit activates the crossing signal.