I want to know how a hardware wallet works, assuming I download the Electrum bitcoin wallet right now and I decide not to use the wallet again, I can just restart the wallet and get rid of the keys and the wallet will generate a new recovery seed for me, is this the same with hardware wallet?
You don't really need to know how hardware wallets exactly work, in a same way you don't know how any other things in the world work.
I never heard anyone getting rid of keys from software wallet by restarting, you need to uninstall wallet and maybe delete few more files.
You can easily perform reset operation on most hardware wallets, and then import of generate news seed words, and everything is done offline, that is the difference from software wallets.
* Can a Trezor or hardware wallet generate a new private key or recovery seed?
You can't generate new private keys, but you can wipe the device and generate or import new seed words.
* Can a hardware wallet be formatted and start afresh?
Yes.
It's not the same procedure for all hardware wallets, but it can be done.
I would even recommend doing this first time you buy hardware wallet, to be sure your generated seed words works correctly.