Hopefully someone can explain how this relay works?

Sounds like a common NSBU switch fault to me.
Just replaced the switch. The weather seal on the 4 pin connector is kinda a wreck. If I insert the connector with the seal on it the connector will not latch on. I left the seal out, reset the CEL. Did not matter. My old NSBU switch is under the truck still, I may try putting it back on, just to see.