A relay is a device comprising an electromagnet (the "coil") and a set of contacts which are activated when the electromagnet is energized.
The moving contact (the "COMMON", or "COM", or "C") is attached to the "armature", a magnetically soft structure which is commonly spring loaded and is used to connect the moving contact to one of the fixed contacts depending on whether the coil is energized or not.
The contact to which COM is connected - and held against by the armature spring - when the coil isn't energized is called the normally closed (NC) contact, and the contact to which COM is connected when the coil is energized is called the normally open (NO) contact.
As shown on the schematic below, with S1 OFF, current from BT1 is prevented from passing through K1's coil and, consequently, the coil is de-energized and COMA is connected to NC, keeping BT2 disconnected from R1.
With S1 ON, the coil will be energized and the magnetic field generated by the current through the coil will attract the armature, which will carry COM with it and make a connection between COM and NO. When that connection is made, BT2 will become connected to R1 through the made contacts, and current will then flow from BT2, through COM and NO to R1, and then back to BT2.
So, you can see that even though closing S1 causes current to flow through R1, both circuits are linked only by the magnetic field generated by K1's coil, their operating currents being independent by virtue of their isolated supplies.
"GPIO DIRECT", below, shows the case where an MCU I/O is connected directly to the relay coil, which will energize the relay if the MCU can supply the current the relay needs without dropping too much voltage internally. The diode is there to suck up the Ldi/dt spike generated by the coil when it's turned off abruptly.
"GPIO WITH GAIN" shows the most likely scenario if an I/O is used to operate the relay, and functions by using a small current from an MCU I/O to turn ON Q1, which in turn allows current from BT1 to flow through the relay coil and the transistor collector-to-emitter junction back to BT1, energizing the relay. The diode is there to suck up the Ldi/dt spike generated by the coil when it's turned off abruptly.
"COMMON SUPPLY" shows a way to use a common supply to power the load,(R2) the relay, and the MCU. \$ \ \ \$ NOT GENERALLY RECOMMENDED.