How do you replace the knock sensor in a 1999 Nissan Quest?

With mucho effort, that's how. The sensor is behind the intake manifold, throttle body ect, all of which must be removed. Labor alone will be 5-6 hundred , knock sensor another 150 or so. Good luck.