2001 Ford Ranger clicks once then won't turn over, and when key is turned off, it begins making a clicking relay noise under the dash? - 1

I've had this happen before, and the last couple times I just undid the battery and put it back in and it started right up. The battery has a charge, the alternator is new, and I tried jumping the battery just in case. So I know it's not that. I'm thinking it could be something in the ignition switch because sometimes I have to lift up on the shifter knob for it to register that it's in park and turn over. Any ideas?

Replace the range switch and adjust it properly.

It's probably the ignition. If you have a lot of keys hanging off the same bunch, the weight will pull on the key and may affect the lock.

The clicking relay noise when the key is turned off… Is that one click or a turn signal sound? If the latter, I suspect the Securilock security system is mad. Use of the proper key should straighten it out, but it sounds like you are using the right key with no success. If that is the case, and especially if the theft light on the dash is lit, you will probably need a visit from an automotive locksmith. The owner's manual (in the source) pages 85-88 have the details.