Fossil fuels are found in nature in the forms of coal, oil, and natural gas, and are the remainder of life that has undergone a treatment of heat and pressure for over 300 million years in order to become what they are today. As these organisms did not undergo a decomposing process and weren't replaced by minerals within their structures as what occurs with regular animal and plant fossils, they became a different fossil variation. This variation has come to be known as hydrocarbons.
Hydrocarbons are molecules comprised of carbon and hydrogen atoms. Since all forms of life are composed of carbon and water (which is made of two hydrogen atoms and one oxygen atom), there is an abundance of the necessary building blocks that are needed to form hydrocarbons. Carbon atoms, which have four electrons in their orbital shells, are the best atom for forming complex molecules as they desire to share electrons with four other atoms in order to complete an orbital shell of eight. Because of this and the special conditions during their formation, carbon atoms bond with hydrogen atoms and sometimes other carbon atoms to form simplistic to complicated chains.
In the most simplistic formation, which is comprised of one carbon atom and four hydrogen atoms, the molecule methane (one of the main components of natural gas) is made. Just as methane is formed which one carbon, additional carbon bonds form heavier molecules. Methane (1), ethane (2), propane (3), butane (4), are all hydrocarbons and increase in fluidity as the number of carbons go up, eventually leading to the formation of oils and plastics. Aside from just hydrocarbons, the carbon atoms can bond to other atoms such as oxygen atoms to create molecules like methanol and ethanol, which is fast on its way to being another valuable fuel source.
Because the formation of hydrocarbons requires a great span of time and an organic source, they are considered to be non-renewable resources. However, as a source of energy as a fuel with a high level of combustibility, and producers of greenhouse gases, they are as harmful as they are helpful. However, despite the negatives, they are invaluable resources until they can be replaced with renewable energies. For now, there seem to be adequate supplies of coal, oil, and natural gas, with reserve location yet to be tapped, but it is certain that those supplies will not last long in this world of demand.
Learn more about hydrocarbon chains and various other organic compounds here.