The collapse of global crude oil prices in 2014 was easily one of the biggest energy stories on the planet. By early 2016, oil had slid to $33 per barrel, a level not seen since 2003. Gasoline was dirt cheap, SUVs were coming back in style, Venezuela was imploding, and the US fracking boom started fizzling. It was a really big deal.

Over the last month, however, prices have started to creep back up again, rising to $50 per barrel on Monday. We're still nowhere near the levels seen before the recent crash, but it’s a noticeable uptick, with potentially important ripple effects around the world. So what’s going on? And will this rally actually last?

Because oil is so easily shipped and traded around the world, prices (mostly) depend on just two things: global supply and global demand. The best place to get a handle on these two factors is the International Energy Agency’s monthly Oil Market Report. The graph below, from the latest edition, tells the tale:

As you can see, between 2014 and 2016 the world was pumping out far more oil than anyone needed, causing prices to crash. Oil production (the green line) was surging, driven in large part by the US fracking boom, Iraq’s postwar recovery, and Saudi Arabia’s decision to keep its own output high.

Meanwhile, oil consumption (the yellow line) was slowing, held back by economic weakness in China and Europe. All that surplus oil was being stored in inventories (in blue) for later.

But as of mid-2016, production and consumption have started coming back into balance, which is putting upward pressure on oil prices. The IEA lists three important factors here:

1) A few key sources of oil have been cut off due to disruptions. The massive wildfires in Fort McMurray, Alberta, have taken more than 700,000 barrels per day of Canadian oil sands production offline. In Nigeria, militants have stepped up their attacks on oil and gas infrastructure. Violence in Libya continues to hinder oil exports there. And Venezuela’s political situation has deteriorated so drastically, the IEA says, that it may soon muck up oil operations.

The US Energy Information Administration notes that "unplanned global oil supply disruptions" are at their highest level since at least 2011. This has even overwhelmed the fact that Iran has lately added 700,000 barrels per day to world markets after the US and EU sanctions lifted sanctions. The net effect is to push prices up:

Note that some of these disruptions are temporary (particularly the fire-related outages in Canada), but others could prove longer-lasting.

2) Global oil demand is growing faster than expected. In part because oil is so cheap, countries are using more of it. The IEA now expects global oil demand to grow by an extra 1.3 million barrels per day in 2016. Partly that’s due to fast-growing developing countries like India. But, surprisingly, US oil demand is expected to surge this year by about 255,000 barrels per day. Americans have been taking advantage of cheap gasoline to drive more miles this year than ever before.

3) Low prices are starting to cramp the US shale boom. What makes crude oil markets so tricky is that prices depend on production — but production also depends on prices.

Back in the early 2010s, when global crude prices were hovering around $100 per barrel, US energy companies decided it would be profitable to go after costly and hard-to-extract sources of crude, using fracking to get at the oil locked away in the shale formations of Texas and North Dakota. The resulting "shale boom" basically doubled US crude oil production and helped precipitate the global price crash.

But now those low prices are forcing US drillers to cut back, laying off thousands of workers and idling their drilling rigs. US field production of oil has finally started falling in 2016, as the chart below shows. And, overall, the IEA expects US shale production to drop by 500,000 barrels per day this year:

US shale drillers have been trying to fend off this day of reckoning by slashing their costs and making their operations more efficient. But at a certain point, economic reality bites down. The shale wells that they’ve already drilled are rapidly becoming depleted (there’s only so much oil a given well can produce), and it will no longer be profitable to drill new wells. (It costs more to extract shale oil than it does for, say, Saudi Arabia or Kuwait or Iraq to pump oil, which is why US production falls first.)

If US oil production rebounds, prices could fall again

Now here’s where things get really tricky: As US shale producers cut back, global oil production will fall and oil prices will start rising. But at a certain point, if prices rise high enough, those shale drillers will fire up their rigs again and resume drilling — blunting the rally. It’s a complicated game of ping-pong.

No one knows for sure how high prices need to rise to convince US shale companies to start drilling again. Is it $50 per barrel? $60 per barrel? Some companies may feel burned by last year’s short-lived price rally and are wary about jumping back in to drill only to then lose money when prices consequently fall. Others may decide to open up the thousands wells that they’ve already drilled but haven’t yet tapped. And if companies do start increasing production, how far do prices fall again? Where is the equilibrium?

So if you want to figure out where oil prices will go next, you have to take this all into account. Some of the factors pushing up oil prices right now, such as Canada’s wildfires, are only fleeting. Others, like violence in Libya and the deterioration of Venezuela, seem more likely to stick around for a while. Oil demand could fall if Britain ends up leaving the EU and triggers economic panic. And then there’s the ever-tricky question of how the US oil industry responds to prices. Plus the fact that the world still has some 3 billion barrels of oil tucked away in storage. No wonder oil prices are always so tough to predict.

Read more: Why crude oil prices keep taking us by surprise