I've been a commercial insurance broker for about 40 years. Roughly speaking, about two-thirds of your car insurance premium is tied to liability coverage -- that's the coverage for what you would owe others for bodily injury, death or property damage if you are at-fault in an accident and they sue.
The balance of the premium is mainly tied to physical damage coverage for the car itself. Since cars become worth less and less as they age (and most policies will not pay you more than what a car in comparable age & condition would sell for on the used market), that two-thirds ratio increases as the car gets older.
An electric car can run into someone else just as violently as an auto with a gas engine, hence there is typically not much premium difference there. However, from a physical damage standpoint, electric cars often have unusual construction and mechanical aspects that may make them more costly to repair.
Ultimately, especially in the personal lines insurance market, the carriers track the claim cost statistics by make and model. That's why certain sports cars (which may be driven more aggressively) may be more costly to insure than a similarly priced SUV or sedan.
Other factors play into insurance rates, including the age & driving history of the driver(s) as well as the territory involved. Urban settings tend to have a higher claim experience than suburban or rural areas. Rural areas tend to have the lowest rates. Finally, the insurance cost will vary by state in the U.S. due to the differing legal requirements.