In addition to all the other great answers there is one very important fact that's always ignored in these comparisons (Google translation, lightly corrected by me):
The total emissions of petrol and diesel are sugarcoated in this example.
For oil extraction, refinery and transport on tankers, in pipelines and trucks 44 kWh of energy was used for our 6.4 liters of diesel fuel. In other words, with this energy, an electric car would have driven 250 kilometers before the diesel fuel even reaches the tank.
The comparison was "per 100 km" so the electric car actually has an advantage of almost factor 3 in efficiency, unless you assume that fuel magically appears at the gas station. The transport of electricity, on the other hand, is almost completely free and lossless.
I only have a German-language source for this as well, unfortunately: https://www.wiwo.de/technologie/mobilitaet/hajeks-high-voltage-1-nachgerechnet-wann-elektroautos-sauberer-sind-als-verbrenner/25218614.html
Dabei sind die Gesamtemissionen bei Benziner und Diesel hier noch geschönt.
Denn für Ölförderung, Raffinade und Transport auf Tankern, in Pipelines und Lkws wurden 44 kWh Energie für unsere 6,4 Liter Diesel verbraucht. In anderen Worten: Mit dieser Energie wäre ein E-Auto bereits 250 Kilometer gefahren, ehe der Diesel-Kraftstoff auch nur den Tank erreicht.
Second of all, the comparison assumes battery production in Asia (as is the case for the Nissan Leaf, for example) with their average electricity mix that's heavy on coal. But automobile companies, especially Tesla, increasingly use renewable energy for the production of batteries and car components with the target to use 100% renewable energy generated from solar panels on top of every Gigafactory. Even without those on-site renewable sources, production of the battery in the US or EU has a higher percentage of renewable energy already from the grid.
So, in conclusion: If you compare a Tesla Model S against the most fuel-efficient Diesel car you can find, ignore production and transportation emission for conventional fuel, take the emissions from the battery production of a Nissan Leaf and assume they are the same for a Tesla battery, twist the numbers some more to support your bias, then you might end up with a 200,000 km advantage.