It can be a pain in the ass. Pull the switch back as if to turn on the lights. Rotate the switch until you can see a slit in it. You should be able to see like a pin with a spring on it and a washer. You'll prolly need a flashlight to see it. Using a small screwdriver or pick. You need to slide that washer back to release the clip. I forget if it has to go forward or back.
Stick a pick or small straight blade screw driver in the slot and while pulling gently on the headlight switch put pressure on the slot in the same direction.