The provider() function allows us to create a configurable service where we can set input per application for the service created using the provider(). For example, if we need to set API key to access a service on the application level, we can set that in the module config and pass input to the provider using the $provide service. All the others ways to create services internally use the $provide service.
Full article