Most knock sensors in use today are microphones. The most common sensor type is a piezoelectric crystal type.
Failure is detected by: 1 Testing the circuit during a power on self test. 2) watching for signal thresholds during normal engine knock producing operating conditions. Field testing is done with an oscilloscope and a hammer. A tap on the engine block should produce a voltage signal on a scope. Plus and minus 2 volts is common. Voltage varies with signal strength. 
P0325 is the standard code.  
As usual OEM failure engine management strategies vary but the most common is to limit timing advance to a known safe range. This will limit both fuel mileage efficiency and power.
Failure is common among some makes and less so with others. For example Subaru installed a high failure sensor from the mid 90's to about 2003. But Toyota sensor failure is uncommon.