a few different things i have found cause this issue.
Always check the connections of intermittant parts, and before even opening the device, try a hard reset. (home and power for 15 second or until you see the apple logo)
if your button doesnt have the mechanical clicking feel, the nub on the button itself could be worn off. a quick replacement of the nub is relatively simple. if it DOES click, than continue on.
if these dont fix it, you should check for corrosion. corrosion is a mineral build up from moisture, clinging onto the metal of your device. be sure to check the connectors on the Board, extension flex, and home button connectors. a quick scrub with 99% isopropyl will remove that.
last attempt is a home button replacement. Without apple OEM callibration machines, you will not be able to have touch ID working again after the repair.
If these dont fix it, i would try a factory reset as a last ditch effort to try and get it working.
Anything further than this, is a problem with your main board.