From a very informative article from Factly here

It won’t be exaggeration to say that the Price of Petrol & Diesel affect almost every Indian directly or indirectly. Such is the importance of these two that any increase or decrease in their price is widely discussed. Ever since de-regulation, the prices change every fortnight based on the changes in the price of crude oil and changes in tax rate. While people at large follow pricing of these two commodities, they do not understand the structure of pricing, the components that add up to the final price. The above video is aimed at demystify the Petrol pricing.

The Retail Selling Price (RSP) of Petrol

Retail Selling Price (RSP) of Petrol is determined based on a lot of factors. The average price of Crude Oil of the Indian Basket is calculated every fortnight. This price is calculated in dollars per Barrel. The price in Indian rupees is also dependent on the average exchange price for that fortnight.

Crude Oil to Petrol

The Crude Oil is transported and refined to extract Petrol. The cost & freight charges, refinery charges are added to the price of Crude oil. This is called the Refinery Transfer Price (RTP). In other words, this is the price paid by OMCs (Oil Marketing Companies) like IOCL, BPCL & HPCL to the refineries. OMCs retain some margin and sell it to the Dealer (the owner of the Petrol Pump).