A relay is an electro-mechanical device that, depending on the presence or absence of a voltage (and thus current) across a pair of input pins, opens and closes circuits between pairs of contacts (which are connected to other pins, for electrical access). How many pairs, and whether they are open or closed when incoming voltage is applied, will depend on the design of the specific relay.
Generally, the incoming current is fed into a coil, which functions as an electromagnet. That either attracts (or not) a hinged, spring-loaded, piece of metal (the 'armature'), which is mechanically linked with contacts which can make or break the circuits with the other contacts, depending on its position.
(Some relays, 'latching relays', do no need continuous current to stay on; they latch on or off, and need a pulse to switch state.)
Early computing devices used relays for logic; a few of them did not use any electronics at all, just relays.