My phone got factory reset and all data wiped, can I find out how?
Well, I don't think you could get to know what has made your device getting factory reset on its own. As far as I know I think somehow the volume up and power keys may have been pressed which results in factory reset. I have also heard the if you put the patter lock wrong over the HTC M8 for more that 10 times, the device gets automatically factory reset. I am sure Accidently you may have !!