How is adding oil going to beneficial to the situation? 加油 Is anyone able to explain the history behind this cheer?

At the face of it I'm unsure how this could be a cheer as 加 translate to add/plus/apply and 油 translates to oil/fat/grease you would think that 加油 would translate to Add oil 

Most of my research showed that 加油 means a cheer or add oil but I've been unable to find any information as to how it translate into a cheer
In a literal sense, 加油 means to step on the gas pedal when you drive a car.

Imagine what happens when you step on the gas pedal? More gasoline is added to the engine. What happens when more gasoline is added to the engine? The engine roarsssss!

If someone is having a hard time, they are like a car being stuck in the mud or a similar situation and unable to move forward. You would encourage them to "add in some gasoline"  加油!