Transmission oil pan. The switch is right above the left rear corner. On Dakotas it is kind of hidden above the cross member. I can't remember if that's the case with the full size trucks. I posted a photo of what it looks like. This is the most common switch but there is a different design too. This is for an automatic.
The center terminal is for the starter relay ground and it doesn't fail very often. The two outer pins connect together for the backup lights. Those DO fail on occasion. A quick way to verify that is the cause of no backup lights is to leave the ignition switch on, unplug the connector, then jump the two outer terminals together with a stretched out cotter pin or paper clip. If you see a very tiny spark, you'll know current is flowing to the lights but to double-check, you'll see the lights are on if you look at them.
That little spark observation doesn't work on the newer trucks starting with at least the '06 models. On those, the insane engineers use the switch to ground a pin for the "Integral Power Module", a computer under the hood which turns on the circuit for the backup lights. I don't think that nonsense applies to an '02 model.
It's recommended you replace the thin metal gasket with the new switch. If you use a used switch, the gasket will stick to it. Few people use a new gasket with them.
Here are some diagrams (BELOW).
They also call it a transmission range sensor
Images (Click to enlarge)
Thursday, November 10th, 2011 AT 8:50 PM