What are AngularJS services, factories, and providers, and how do they differ?

Services are singletons instantiated with new, factories return objects, and providers offer the most configuration flexibility, available during the config phase. Providers are ideal for complex setups, while services and factories are better for general dependency injection and logic reuse.