A relay is an electrically controlled switch. Electromechanical relays use an electromagnet to activate mechanical contacts, solid-state relays use semiconductor switches.
A latching relay stays in the current state when power is removed. A non-latching relay reverts to a known state when power is removed.