I have the same issues - it is getting really frustrating now.
Phone resets/shuts down when battery reaches 10%, sometimes below 20%. After this, all app permissions are reset to default and all Google settings (e.g. Ok Google voice settings) are reset to default. I have switched off Power Saver, which reduced the number of resets I've experienced but did not fix the issue.
After some reboots, I get the "optimizing apps" message. Thereafter all my contacts are deleted (have to delete and add back my Google account to get them to sync again). In addition, all Google app and HTC app updates are deleted and I have to update again from the Play Store. Call history and all other app data is deleted (have to log into all apps again). However, my internal storage is still full so the actual data is still on the phone somewhere. This is in effect like a factory reset, only my data is still on the phone but inaccessible to my apps. This has happened to me twice now - seemingly at random times. Interestingly, both times I've been away from home - maybe Google location services/GPS or something is causing the crash?
This is really irritating. I have not had this much trouble with a phone since the days of Eclair on a SonyEricsson (which says a lot). My HTC OneX (previous phone) was still working perfectly after two years. Before Marshmallow the M8 was running perfectly as well. Wish I never upgraded.
I was going to buy an HTC 10, but I lost all patience with HTC. If they did this to try and get me to update to another phone, it's not working. I will update - to anything other than HTC. HTC can really not afford to **** off the few loyal supporters they currently still have.