Your relay is not as simple as Seasink thought based on your initial description (or lack thereof) so you can't just walk in the shop and hope to find a replacement blindly. You need to check the diagram on the casing and the terminal number and position on the casing you removed and match that.
If you want to give it a go at saving that one (looks possible to me), read on.
Those electronics are subject to some serious shaking in a car and often the soldering on the PCB goes "cold" so they don't make contact anymore. Add condensation and you have your answer. Tapping it can move the terminals minutely but enough to coax the relay back to life.
The coil itself and the moving contacts rarely go bad, but it is not impossible. If visual inspection doesn't reveal corrosion on the moving contacts I would suggest you need to reflow the soldering on the PCB (add a minute amount of solder and reflow all of them).
As matter of course, inspect the hinge point of the moving contact and make sure it's healthy. Clean with isopropyl alcohol (brake cleaner for instance) and apply some D5 spray to protect and lubricate. Don't use WD40 anywhere.
Also last but not least, clean the relay spades with isopropyl alcohol and a stiff toothbrush (or scotchbrite) and apply D5. This goes for the mating plug as well.
Relays are also used when you want to protect a switch (or whatever) or make its life longer (say because it is expensive) whereas a relay is cheap so you put a small current through the switch to control the relay coil and let the relay take the abuse (large current). It is also often more convenient to have a long wire going to a switching element (say on the dash) and back to a relay very close to the load (the main consumer of power, e.g. headlights, cooling fans, etc.) so you keep power wires short to minimise losses.
Or you can use a relay to control one circuit with another but keeping the two completely separated (no electrical connection between the two).
DeoxIt D5 (Altronics, Jaycar, etc) - this actually works even without mechanical cleaning of contacts/electronics:
https://www.mektronics.com.au/pub/m...c7311230da32edc21fe9c686a0b/d/e/deod5s-6a.jpg