Pass a class or function constructor to the service. Angular will do the equivalent of calling "new" on it.
Pass a function that returns the object you want to the factory. Angular will take what you pass, call it, and use the return value.
For example, factory:
function(dep1, dep2) {
return {
total: dep1.x + dep2.x
};
}
Service:
function MyClass(dep1, dep2) {
this.total = dep1.x + dep2.x
}
Factory is usually fine unless you are using a language like TypeScript or CoffeeScript that directs you more to classes.
The Provider is simply a service that can be configured once. In other words, if you have something that needs to be set up when you are initializing modules in the config block, use a provider. That allows you to tweak configuration before it is stored as an object to be used.
Let me know if that answers your question!