How to recover jailbroken iPhone?
Put it in recovery mode and restore from iTunes.

To put it in recovery mode, turn the phone off if possible (by holding down the power button), if not possible hold down both the power and home buttons to do a hard power off.

Finally, connect the Lightning cable while holding the home button, the phone should power up and then display the recovery mode logo; at this stage you can release the home button.

The rest of the process takes place on your computer.