Have a look here:
http://www.therangerstation.com/tech_library/4wd_control_module.html
The electric 4WD system is simple and complicated at the same time
You have 3 parts, not counting wiring and fuses
4WD switches
Shift Controller
Shift motor
The shift motor is a DC motor like a Power Window motor, if you send it 12v/Ground motor turns clockwise(window down) if you reverse it to Ground/12v then motor turn counter clockwise(window up)
The Relays you hear clicking are in the controller, and they set the 12v/Ground polarity going to the shift motor.
So how does controller no what direction to turn motor/transfer case?
There are 5 wires on the shift motors gear box, these are contacts inside the motor.
Look here:
http://www.explorerforum.com/forums/index.php?threads/how-to-rebuild-4x4-shift-motor.123542/
These contacts "tell" the Shift Controller "what setting" the transfer case is in by which contacts are open and closed.
2WD, 4high and 4low each have unique contact settings
When you select 4high, for example, the shift control gets that input from the button.
It then "looks at" what contacts are opened and closed(what setting transfer case is in now), if it was in 2WD then controller closes relay to turn transfer case shifter counter clockwise until contacts show 4high, controller then opens relay, AND then turn on 4high light<< that part is imporatant
4WD lights are NOT controlled by the buttons or switch, they are turned on or off by the Controller once correct position is reached.
So there should always be a delay from when you push the button to when light comes on or goes off, shift motor has to move transfer case into correct setting.