how we get oil from earth at 5km how we get inform that there is oil inside it?
You mean: how does the petroleum geologist decide where to drill?
This is the subject of a college level course lasting years - what do you need the information for?
Have you seen:
How petrol is taken out?
I am from Electrical and electronics.
What have you done to try to find out for yourself?
Have you, for instance, googled for "how is petrol made" and found the following:
Separate names with a comma.