The diode is placed across the coil of the relay. It is the only place there will be what is called "flyback." The coil of the relay of course stores energy. When the power is removed suddenly, (float switch opens) the coil discharges, the diode gives the "voltage" somewhere to go, rather than burn up the relay. An N4004 diode should be enough. The flyback voltage can be a magnitude higher than the supply voltage. (sometimes 100's of volts.)
The circuit is called a "latching" circuit. It is designed to reduce superfluous opening and closing of the relay contacts. It is the most time tested and reliable method for this type of application. It has literally countless uses, but that is a subject for an electronics forum.
But as others have pointed out, if the pump is a 12v pump, there is not much point in using a relay/latching circuit. However, it can save some wear and tear on the float switches. They are not the hardiest of devices.