Depends on which HTC you have, if it is the from the ONE Series then when the device is powered off hold the power and volume down buttons down at the same time which will bring you in to recovery mode, from there it should be able to perform a factory reset