Marshmallow: Apps NOT battery optimized still seem to doze off
Apps are designed how they are designed by each developer. Apps can acquire wakelocks and keep the cpu (for instance) from sleeping thereby allowing the app to stay active: http://developer.android.com/training/scheduling/wakelock.html

A great app will do this as little as possible especially as apps can set alarms to check the internet for updates or an app can wait to receive a push from an internet server.

Apps never sleeping is the wrong way to look at it and will do nothing for you but hasten the battery usage for typically no good reason.

If there's an app that stops working when it should stay working then the developer should be contacted so as to let them know you want it to continue working even after situations where it may have become disabled regardless of what happens.