It's common in Europe for many cars to have a Diesel or Gasoline version.
Usually,
but it is not a rule , if the model of the car has a letter D
it's a Diesel car, but this is not a rule.
It's not a rule as well for the car to have a letter on the model name.
Usually in Diesel cars you will find some warnings about it.
The rental car agent will tell you Next to the gas tank a warning about the type of petrol.
The diameter of gasoline hose has a different size of a diesel hose.
It will be hard to put the wrong hose inside the tank.
The label on the key could have DIESEL written on it (HERTZ does that)
travel.stackexchange.com/users/9283/Afetter
In addition to the methods already mentioned: Have a look at the car documents.
When you start your engine, or when you have driven some meters youwill know it.
A diesel sounds and feels differently from a gasolinecar.
A look at the rev meter can be revealing.
The "red area" starts ataround 4500/5000 in diesel cars and at 6000 in gasoline cars.
Open the tank.
Diesel and gasoline have different smells.
Diesel has a typical "oily" smell.
travel.stackexchange.com/users/11860/Maître Peseur
It's often very difficult to put diesel fuel in a regular gasoline car by mistake, the nozzle of the fuel dispenser is typically way too big.
I assume there might be some international standard behind this, at least I noticed it in several countries (but I also came across some exceptions).
Making a mistake the other way around is actually not that difficult, I have seen it happen.
Diesel rental cars therefore usually have prominent signs in several places, including on the little door or cap of the fuel tank itself.
I also noticed this on diesel rentals in several European countries.
travel.stackexchange.com/users/6669/Relaxed
Look at the Glowplug Indicator Fuel combustion in Diesel engines is achieved by temperature rise due to fuel compression alone , without the need for spark plugs.
This however means that a cold engine -- i.e. one that has been switched off for a while, or one used in cold weather -- might struggle to ignite at start-up.
This is why diesel engines are often fitted with glowplugs .
These are electronic heating devices used to preheat the engine to facilitate their ignition.
Turns out that diesel cars have a glowplug indicator which lights up when you turn on a cold engine.
As you step in the car, turn the key to the "on" position, without igniting.
Various indicators should light, including the glowplug one, if relevant.
The glowplug indicator can therefore serve as a hint to know if your car runs on diesel , and looks like this ( courtesy of Wikipedia ):
travel.stackexchange.com/users/22140/JoErNanO
If it's a UK vehicle you can do a DVLA lookup using the car's make and registration.
It will give you a short list of information about the car.
About half way down is the fuel type.
travel.stackexchange.com/users/25875/Jools
In the United States, unless you're renting a large truck, it'll be a gasoline car.
That said, virtually every vehicle in the US is marked either on the gas cap or on the filler door with the type of fuel needed, e.g. "87 octane unleaded".
Additionally, there may be a note near the fuel gauge saying the same thing.
travel.stackexchange.com/users/14002/Mark
The neck of the diesel tank is bigger than the gasoline
tank.the diesel tank neck is about 24 cm while gasoline tank neck is about 21 cm.
So the diesel pump nozzle will not fit into the gasoline tank neck easily.
Secondly, it will be displayed on the tank head cap.
travel.stackexchange.com/users/29271/Waqar Shehbaz
Quite unlikely, but what if I rent a car and forget to ask if it takes diesel or gasoline? Is it customary that it's written next to the gas tank inlet (I've only rented a car once, and this was the case).  Or is this something that is easily deduced from the car name? Any other method?
How does one know if a rental car takes diesel or gasoline?
travel.stackexchange.com
<car-rentals><automobiles>
travel.stackexchange.com/questions/24407
travel.stackexchange.com/users/2708/Saaru Lindestøkke
Virtually every vehicle in the US is marked either on the gas cap or on the filler door with the type of fuel needed, e.g. "87 octane unleaded", and diesel cars usually have prominent signs on the key, fuel tank cap etc. Diesel pump nozzles are usually too big for a petrol tank, and will not fit easily. You can also check the car documents or search for it based on the make and registration. Rental cars usually have notices telling you what fuel to use. In the evnt that they do not, you can check the car documents or check out the DVLA website if you are in the UK. It is actually quite difficult to put diesel into a gasoline car as the diesel pump nozzle is bigger and will not fit in the tank. 
There are usually warnings on diesel cars to tell you wha fuel to use. Diesel cars also feel different from gasoline cars. The diesel pump nozzle is bigger so it will not fit into the gasoline tank. The car documents or DVLA if you are in the UK will tell you what fuel to use. In the US large trucks are almost always gasoline and vehicles are marked with the kind of fuel to use.