The insurers are using something called “the law of large numbers” to calculate selling price of their extended warranties. If they sold one policy to one vehicle owner, it would be blind luck who came out ahead. When they sell hundreds of thousands of policies, the insurer has very good data on how much they will pay out in total so can set the premium to cover costs, payouts and a profit. So yes, they always “win”, even if they take a beating on a single lemon.
Most individual vehicle purchasers don’t ever get away from blind luck because they are never going to buy enough vehicles.
I bought the extended warranty on my diesel truck for peace of mind. If I bought the gas model I’d put the premium into a CD or mutual fund and take the gamble. I buy new and run them into the ground before buying again. If I bought new every two or three years, I'd never buy an extended warranty.
There’s no right or wrong answer, whatever you prefer to do is correct.