as htc M one 8 has an inbuilt battery you fist have to open the back cover and unscrew the back panel then you can remove the batteryu and replace it with the new one.
Is it possible....yes. By you and me? Not really. If you love the phone...take it somewhere and get it repaired. Otherwise, go buy a new phone.
Am providing a youtube video to show the teardown.
Semper Fi,
Z
Make sure the SIM card can be used with the new phone. Some are not compatible. If you have this problem, copy the contents of the SIM on a PC or Tablet and then copy the file to the new SIM. Hope all comes out ok.
I assume your HTC phone is running Google Android. And here is a guide about how to recover Android device data, it will help you retrieve the contacts and data. How to recover lost deleted Android Data