Sometimes the oil is collected but the gas is burned off because it is not economically feasible to collect it. Kind of like in this picture: https://www.alamy.com/an-oil-well-pump-jack-natural-gas-flar...
Well, there is typically no electrical grid by an oil well, so what to do with it might be the biggest problem