The knock sensor is on the engine block it picks up detonation and retards the ignition timing when it senses detonation to save the engine from damage. It may be the sensor or a damaged wiring harness.
For replacement instructions, Autozone have some popular workshop manuals for free on line once you register (for free) on their website http://bit.ly/autozone_repair_info or there is a company that independent auto repair shops "buy" their information from that offer a very reasonable service to do it yourselvers. You can get a one week subscription or year subscription very cheap. The information is year make and model specific repair procedures, service bulletins, component locations, wiring diagrams ect.... great quality information same as the professionals have ,much better than generic workshop manuals from parts stores, much cheaper than the factory manual try http://bit.ly/mitchell_repair_manuals_online
and get an online repair manual subscription.