Sedimentary rocks and fossil fuels

How are sedimentary rocks and fossil fuels formed?