I have an HTC One (M8). I wake up at 5:00 and the battery is at 100%. By 4:00 the battery is at 17% or lower and I haven't even done anything with it. What's the deal?!?!
Check any application utilizing push notifications and disable push. On weaker LTE signals and when in 3G areas such applications will shred your battery life. If you are often in areas that include Wi-Fi access you trust, leaving Wi-Fi enabled at all times can eliminate some problems caused by poor signal or push data. The Wi-Fi radio uses considerably less power and can remain active for much longer than a mobile data radio can on battery. Applications that tend to be the biggest cause of push data are social media applications, followed by e-mail.
If you would like something that will allow you to continue to use apps with push settings, the HTC One M8 may be supported by an app called "Snapdragon BatteryGuru." This application is a pretty handy battery saver that IS NOT a task killer (please don't use these), but can control when apps sync and can also disable the mobile data while the phone is idle for those apps it cannot control. This application "learns" based on how you use the phone.
Away from that, make sure you are closing applications out properly. When done with an app, you should "Back out" of the app using the back button. Since Android is an actual multi-tasking OS utilizing the Java runtime (unless the app runs in ART) and a Linux base, applications can and will continue to run in the background if you simply hit the Home button. Games, speed testing applications and web browsers are notorious for this. Android at some point will suspend or kill the app, but this may not always work in your favor.
Just some tips.