A relay is an electrical switch that opens and closes under the control of another electrical circuit. In the original form, the switch is operated by an electromagnet to open or close one or many sets of contacts. It was invented by Joseph Henry in 1835. Because a relay is able to control an output circuit of higher power than the input circuit, it can be considered to be, in a broad sense, a form of an electrical amplifier.
The HID kits are most of the time a direct plug and play kit The ballast may or may not contain a relay built into it but the last few cars I've had (even my motorcycle) I've never needed to add a relay for the HID's to function.