The two components are connected in series so that the varying resistance in the sender will affect the position of the needle on the gauge.
Most are wired through the ignition switch, so that they work only when the ignition is switched on. This prevents you accidentally leaving something switched on which might cause the battery to go flat.
Often, however, it is hidden away, perhaps under the dashboard or down in the front knee-well. The car handbook usually gives the location, but without a book finding the box can prove difficult. Get to know where it is before anything goes wrong.
Apart from the main charging, starting and ignition circuits, there are other circuits that power lights, electric motors, the sensors and gauges of electrical instruments, heating elements, magnetically operated locks, the radio and so on. All Circuits are opened and closed either by switches or by relays - remote switches operated by electromagnets.