Google has added two new features Doze and App Standby to save battery in Android 6.0.

Doze reduces battery consumption by stopping the app’s background CPU and network activity when the device is not in use for a long time. App Standby The app with which the user has not been interacted recently stops their background network activity.
To set the Doze mode, go to Settings> Battery> Battery Optimization. From here you can select apps for Doze mode.
In standby mode, you will find most inactive apps in developer options. Here you will see a list of all apps. Here any app can be toggled between active or inactive. Don’t worry – the inactive app will be activated on opening.