Bit of a complex subject for a short answer, but a few pointers:
In a lubricated bearing it is mostly down to the dynamic viscosity of the lubricant, bearing area and velocity (rate of shear in the lubricant).
For solid to solid the dynamic mechanisms vary with crystalline and plastic materials, but work is imparted to the surface material as dislocation movement, bonding energy etc.
Static friction doesn't involve any work and relates mainly to surface topography.
Air friction (e.g. skin friction) is similar to the lubricated case, except that turbulent flow makes the sums a lot harder.
All this is from memory and some long ago work experience, failing a more expert response try searching under tribology for more detail.