Relays are electro-mechanical devices and can fail in multiple ways. Here is a typical relay:
The armature is connected to the power being controlled, in your case it is connected straight to the battery.
The top contact is the normally closed (NC) contact, meaning that with coil is not energized the armature is making a connection with that contact. In your case this contact connects to nothing.
The lower contact is the normally open (NO) contact meaning it should only make a connection to the armature when the coil is energized. In your case this contact is connected to the
fuel pump
If the coil opens the result is the relay remains in the non-energized state and your fuel pump never runs.
If the coil shorts the result is the relay remains in the non-energized state and hopefully a fuse blows.
In some applications, the normally closed contact is connected to something so current is flowing from the armature to this contact. This means that one failure mode is when the armature and normally closed contacts "fuse together". So even when the coil is energized the armature remains in the non-energized state. sometimes you can diagnose this by tapping the relay causing the fused contacts to "unfuse" and the relay armature then connects to the normally open contact. Fused contacts can be an intermittent problem.
A weak spring, along with the armature and normally open contacts fusing, can result in the symptom you have, i.e. the fuel pump keeps running with the key in your pocket. Again tapping the relay may result in the armature returning to the correct state.
So anytime I have a problem with a circuit controlled by a relay, I tap the relay. If that clears the problem then I know the problem is likely the "fusing contacts" on the relay, so I then replace the relay.
If tapping the relay does not diagnose your problem, then you have to see if the proper voltages are getting to the coil and armature. If that's good then is the you check to see if the proper voltage is exiting the relay, i.e. what's the voltage drop across armature and the NC/NO contacts? Worn armature, normally open or normally closed contacts can result a significant drop in voltage exiting the relay. If all of this is good, then the problem is not the relay, so look elsewhere.