There are refineries with different performances. They produce more or less barrels of refined oil a day. The Chevron's Pascagoula Refinery's daily production, for example, is around 330.000 barrels. Apart from the high-tech equipments, all refineries work with the same process plan, which is made of 4 steps.
The first step is the Distillation. Crude oil is pumped through vertical pipes, similar to towers, in hot furnaces. So, the light materials, hydrocarbon molecules and others will be separated from the heavier stuffs. The pressure is playing a very important role in this process. While light materials, like propane or butane are going up, the medium and heavier ones remain lower in the pipes. Residuum is one of the heaviest matter we can mention. While the separation nothing is going astray. The oil industry is big enough to find a use for every material.
Next step: Cracking. The products quality is very important nowadays. Also the thrift. That is why it is important to use as much matter as you can. During the cracking process, the big molecules will be turned in smaller ones. Heat and catalysts are the main technical additions here. Because of this, medium and heavy oil and gas oil can be turned in gasoline, jet and diesel fuels.
Treating is responsible to reduce air pollution, while extracting natural impurities, like sulfur and nitrogen.
Commonly, refined gasoline will not burn well in cars, because of the absence of octane. This molecules have to be added in an extra refining step, called reforming. With a precious- metal catalysts /platinum and rhenium/ high octane molecules get into the gasoline particles, and so develops that gasoline, that we all know.
At the end, all products have to be blended, and the quality control has to be done. Together with other tests, chemists check in their high-tech laboratories also the octane rating of the new products.