https://en.m.wikipedia.org/wiki/Gas_flare
These are used for a number of things, from burning off ‘waste’ gases to converting methane to CO2 thus significantly reducing environmental impact. The purpose and frequency of use are dependant on the process(es) they’re associated with, so the ones you’re looking at could have any number of purposes. Most likely, it’s to burn off excess natural gas or relieve pressure from another part of the process.
Source: Environmental stack tester in U.S.
Usually when oil is extracted, there comes with it a crapload of water and natural gas. The fluids go into a vessel called a separator which, you guessed it, separates the oil, water and gas.
The water is taken aside and usually pumped back into the ground or purified and used for other purposes. The oil heads to a fractional distillation column. The gas that is left behind is usually not pure enough to make it worth purifying, compressing and storing/selling. So what do you do with all this flammable-but-not-pure natural gas?
In some plants they use it to feed the boilers that power the plant itself or provide other functions. But sometimes they cant do this or the amount of gas produced is just so high that the boilers cant use it all. In those cases, the most economical thing to do is to just burn it. As pointed out before, the carbon dioxide has a lower impact on the environment than the methane otherwise would.
Besides the common burning excess natural gas others point out, they also serve a more general safety purpose.
Many if not most of the processes in a refinery or chemical plant deal with gases as inputs, intermediate or final products. Just like with natural gas (as everyone else mentioned) if those products are released it is much safer to combust them than to allow them to be released in their uncombusted form. So, many of the flares you see are kind of like pilot lights on your water heater or other natural gas appliances. They stay lit so that when there is an upset in the plant the products can be shunted to the flare stack and burned (automatically) before they are released.
If you have to ask yourself if you have ever seen a plant burning off excess product during a process upset, you haven’t. If the plant or process is big enough, the roar can be heard for miles and they can light up the night as bright as day for just as far.
Latest Answers