Relays are a common item used to power units requiring a higher voltage or current than a microcontroller can handle and/or a unit or sensor that has a high electrical or current consumption. For automation its usually connected to a microcontroller and sensor that turns something on when a specific data point is reached or detected and turned off when the data point no longer exists or is valid.
An example would be if you had a microcontroller such as an arduino connected to a PIR sensor and a relay connected to a camera. You could configure the arduino to activate the relay when the PIR detects a heat source nearby, say if someone were entering your room or if you wanted to watch what your pet pig was doing when you let it outside. Being that the required voltage and current ratings are well outside the arduino’s capability -about an amp of current and 125VAC– you would have to connect the camera to a relay to safely power and control it. But how do you know which relay is right for you?