How is adding oil going to beneficial to the situation? 加油
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"  加油!