it depends on the engine for exact location, and number of O2 sensors, but on my 01 2.3l ranger there are 2, and they are easy to see. look for the exhaust manifold, and imagine you are traveling towards the back of the truck from the manifold. the first one is right past the manifold, and the second one is just a foot or two past that one. The one closest to the exhaust manifold can be seen from looking in the engine compartment. the second one you have to get under the truck to see. have fun getting them off....
if it's a four cylinder, it has two. if it's a six cylinder it has four.
Check the engine code using a code scanner. That will give you the best information.
I have a 2000 and I tried to get around replacing the knock sensor. I replaced fuel injectors, wires, plugs, distributor and some other parts. all this helped, but van still lose power and surges after engine hot. I been told after all this that the knock sensor retards timing and causes the fuel not to burn as it should. it not only senses knock, but is a protective device for the engine. I just purchased one on eBay for $65 and will install later this week. should have replaced it when I first got the code. caused foul plugs and injectors. tends to rut hotter than normal and surging. mine ran fine for a while and the problems came at a bad time. had to get towed to dealer.
On my 1989 f250 the oxygen sensor is in the exhaust header pipe a few inches in front of the catalytic convertor