Tech billionaires turned local politics into a laboratory. What they discovered was a formula for power.