The world may or may not run out of oil, due to the fact that life has continued to exist despite humanity's best efforts to erase it there will be more oil... eventually. But the question asks what will happen when the world does. Assuming that it means on a current time scale as opposed to one further down the road when the Earth in fact no longer exists, thus no oil, then there are answers concerning that as well.
Preferably it would be best if humanity didn't press the limits on oil consumption as fuel efficiency could potentially be much higher thus resulting in many more years of usage. However, if there is no more oil then there isn't a problem. Problems only exist when there are no solutions, in which this case there could be many.
Now, the key is "many". There could be many solutions to the perceived predicament at hand. The main question is "Which path is in our best interests?" Why? Of course acceptance and economics are important fundamentals to the solution. Should civilization accept the first solution or focus on the easiest? Which would be the best to transition over to that wouldn't compromise existing infrastructure and a way of life in which we are familiar?
Of course, the golden egg is seen to be a new type of fuel source for vehicles that could allow current fueling stations to remain after some remodeling, thus preserving the jobs and important businesses that help keep the economy stable. Idealistically this would great. A "in with the new, out with the old" way of thinking would certainly be helpful in the transition. The problem is the source of the new fuel. At this time, liquid hydrogen is the proposed candidate, yet it is actually very difficult to mass produce.
Currently, the best method is to use electrolysis to separate water into its respective components; hydrogen and oxygen, by passing an electric current through the water. However, the source of the pure water would require large facilities to purify available sources, most likely the oceans, before the high energy process of the separation. After separation the hydrogen would have to be compressed and stored before being shipped to fueling stations. All of which is a very costly process. The energy needed would be staggering unless employing nuclear or natural energies of the sun, wind, and geothermic systems. The massive generation of such energy may be better utilized by the next possibility.
If fuel is out, then electricity is in. Cars were originally thought suitable to use electricity but instead manufacturers chose to make use of the naturally abundant quantities of oil. However, most electric vehicles have proven to be disappointing. Leaving the conspiracy theories out (along with the rumors of the ultimate electric cars long scrapped) electric is not a sensible solution unless battery life is extended or recharging can be done in a faster and more efficient manner. Although fast electric storage has been achieved in China by use of capacitors instead of batteries, the duration of charge hold is very short and would only work in a city environment where periodic recharge could happen each block.
The other problem associated with electric (given longer battery life) is that grid strength in any given area would need to be much larger and supported via non-fossil fuel sources. As mentioned above, nuclear or renewable sources would have to supply the energy, which would require a much greater network of new power generating sources that would take years to install. Of course, that is if the entire world tried to shift at once in response to a crisis.
However, the solution to the world without oil has been found either way. Although trivial in power generation, small amounts of natural energy can be siphoned and used by the public if there are enough sources provided. Instead of over night, this is best done by starting now and in areas that can support it.
The small town of any country was often considered the backbone and supporting structure of any economy until the grandeur of cities and shift of industry began to drain from them. Now, small towns can rise again, installing solar panels and wind generators to homes in the community they can be the power source. Such self sufficient power communities already exist in the world today and need only spread.
Power grids can be supplemented by nuclear and public generation stations to support the large cities. Blackouts could be a thing of the past and electric vehicles could be charged in the home without ever needing to pay a fee. Oil heat can be replaced by natural heat of the Earth below a house or by electric units supported by the cold winds. The possibilities are endless.
In a world with oil, humanity has traded the oil like a currency and left Earth's prospects just as black as it own color. But wipe away the crude and the clouds will become white again. The power of the sun will strengthen and the energy will flow. In a world without oil the prospects are not dark, in fact, it's possibly that much brighter.