Oil will not dissolve in water because water forms a polar covalent bond and oil forms a non-covalent bond. According to the U.S. Department of Energy, in chemistry molecules dissolve with other molecules that share similar characteristics.
In water, the electronic charges are localized on specific atoms, and the charges on an oil molecule are de-localized over all of the atoms. Thus, water will dissolve with other polar molecules but will not dissolve with oil. When oil and water are combined with one another, they tend to separate, with the oil accumulating into one glob on top of the water. The oil floats because it is lighter than water. When the oil and water are mixed together, the oil will form little balls throughout the solution of water before it floats back to the top.
Detergents have polar ends, which combine with water on the non-polar ends. When detergent is added to the oil and water mixture, the non-polar end of the detergent embeds itself into the detergent and the polar ends face the water. This allows the oil to stay suspended in the water longer. When washing dishes, detergent is added to the water, which attracts the oil, so the dishes can get clean quickly.