Underneath the throttle body, with a few inches of 3-wire harness leading to a teardrop shaped plug. Green, orange, and black I believe the wires are. Some people said they've been able to remove it without removing the throttle body, but I just pull the throttle body off.
Remove intake tubing at the very least. If you need to remove the throttle body, just unplug all the electrical harnesses on it, and leave the two coolant lines connected, just dont run too far away with the throttle body, you'll only need to turn it sideways to get a philips-head screwdriver in there to pull the sensor off. Two screws. make sure you get the new on installed the exact same way as the old one.
Is the way to test it, Is to unplug TPS and if it cuts the truck off it's good? Also the same with the Idle control valve? Just wondering , Iwas told this by a guy at Advance Auto, If that is the truth, I unplugged them separately and it did cut truck immediately. Can the Throttle body just be bad or need a good cleaning?