A good ground is essential as it completes the circuit . It's why I suggested a dedicated ground wire to the motor .
I can't see the contacts in the switch , but it's likely the switch just needs a good cleaning .
Have you tested the headlight bulb to insure that it is good ? Both high and low beams .
The 2nd blue can be removed or taped .