From the point of view if electronics, relay, or in general case, a solenoid is just one induction coil. When current runs through it, it creates magnetic field. Now, when currnt is off, magnetic field disappears, and as shoul changing magnetic field do, it induces current in a coil - opposite to what it was, and possibly, high.
And this is dangerous, as it can damage connected electronic components.
It comes by different names: Back-EMF, CEMF (counter electromotive force), flyback voltage, etc.
What we can do is shortcutting this current using a diode (it will only shortcut the opposite current, not the one we consider a good one, ad diode only works in one direction). So it works as a shunt. It can be called a flyback diode, suppressor diode, freewheeling diode, snubber diode, clamp diode, commutating diode, or catch diode.
Common diodes
In relay documentation, we can find the "rated current" (relay coil current) and the coil current. Usually it is suggested to choose the diode with voltage level 2x to 3x the coil voltage. Also, forward current values is usually suggested as “at least as large as the load current” (coil current). Some other sources suggest 10x as the diode voltage level. Usually, unless you have specific requirements, the 1N00x diodes are used, where 1N001 is 50VDC and up to 1N007 at 1000VDC. For most relays, 50VDC / 1A diode will be enough.
Zener Diodes
Using diodes can increase the release time of the relay contacts. This can cause damage and reduce the lifetime of the relay. Zener diode are used if this is a problem. Usually, a Zener voltage close to the level of the coil voltage is suggested.
Relays with Built-In Coil Surge Protection (Absorption)
There are such products, and they can be used instead. The only problem is, they are not easy to fix if damaged.