Relays are electromechanical devices used to control electrical circuits by opening or closing a switch based on an input signal. Their construction typically consists of a coil, a set of terminals, and a mechanical armature. When current flows through the coil, it creates a magnetic field that attracts the armature, causing the contacts to close.