Personally, I’ve found the most effective technique is to approach them REALLY fast. At least 25mph faster than their speed. Then brake hard on their bumper before dropping back to a generous following distance. It usually makes them think they were going so slow that I had to panic-brake to avoid hitting them. By the time they regain their composure, they’ve already moved over to let me by.
I find that flashing the headlights either has no effect, or makes them slow down/brake-check you in retaliation.
Side note: I’ve never had someone speed up to block me from overtaking. I’ve heard that it happens, but I’ve never been a victim of it myself.