IAC valve and the TPS are "learned" devices.
Any cleaning or replacement of these requires you to reboot the computer so it will "relearn" how the cleaned or replaced devices operate.
Unhooking the Negative battery cable for 5 minutes will cause a Reboot when computer starts again.
Or, of course, telling the computer to reboot using an OBD II scanner/reader.
P0505 means the IAC Valve is not responding correctly to computer control.
This can mean IAC Valve is faulty.
It can mean the wiring to the IAC Valve is faulty.
It can mean the computer circuit to control the IAC is faulty.
After new IAC Valve is installed, and computer reboot, the computer will relearn the valves settings to maintain specific RPMs.
RPM reading comes from CKP(crank position) sensor, and engine won't even start if there is a fault with the CKP sensor, so we assume that is working.
Computer has "soft" cold engine idle target RPM, "soft" because it is based on engine temp, so varies.
Engine temp is read by the computer using the 2 wire ECT sensor, this is a sensor not a sender, and is only used by the computer.
There is a 1 wire sender used by the dashboard temp gauge, usually located near the 2 wire ECT sensor.
Engine temps under 160degF cause the computer to increase the idle RPMs, the colder the temp the higher the RPMs.
40-50degf usually will set 1,100-1,200rpm idle, colder will be higher
A faulty ECT sensor could cause a higher idle, BUT(big but).......the computer has a timer that starts when engine does, after about 10-15minutes of engine running if the engine temp is not above 180degF, the computer will turn on the CEL and set a code for the engine temp, "failed to switch to Closed Loop" or similar.
This could happen from a faulty ECT sensor or if thermostat was stuck open and engine could not get warm enough on a cold day, the second one could be IDed by the dashboard gauge also showing colder than normal temp, i.e. under 1/3, normal on most Ford gauges is just under 1/2 after warm up.
As engine warms up "soft" idle will slowly go down, computer slowly closes IAC valve.
Computer will have a "hard" idle target of 700 for manual trans and 800 for automatic.
It can vary as much as 25rpm but usually no more than that, it can also vary by engine, it is based on emissions standards for the engine.
When you turn the key on, the computer will open the IAC Valve all the way, it will then read the ECT sensor temp data.
When you start the engine the RPMs should go up to above 1,500 because IAC valve is open all the way, RPMs will then drop as computer closes the IAC valve to match target idle as determined by engine temp.
If this doesn't happen then there is a problem with the system.