See related link which is only related to US wells.
The depth at which hydrocarbon deposits are found varies greatly. Very shallow deposits of less than 100 feet were found in the early days of...
A type of ultra sound is used to determine that it is gas, but a densomiter is used, much like when construction workers chech soil density. a very un-dense area is found and then ultra sounded.
Sand and silt changed to rock, covering organic material, and trapped it beneath the rock. Pressure and heat changed some of this organic material into coal, some into oil, and some into natural gas.