It is done by movement and torque
Inside each hub are pieces that slide to lock, then slide to unLock
When in 2WD a front wheel turns but axle doesn't so that motion will unLock the hub if it was locked, slides the cam out
When you engage 4WD the axles are now powered, so when you move the axles turn and pull cam in and Lock the hub, and it stays locked as long as axle has power.
When wheel starts to turn axle again(2WD) the drag causes the unlock.
The hubs to tend to stay locked even in 2WD, if one or both are not unlocked, back up 50ft or so and that will unlock them, it doesn't hurt them to stay locked, as long as you don't hear a clicking noise, if you do then do the back up thing
Most common problem with these is Grease, people pack in grease because there is a wheel bearing in there, but the 4x4 hub cover is NOT a grease cap.
So clean off as much of the grease as possible, then clean it ALL OFF, lol.
And give the parts a coating of motor oil or ATF, this allows the cams to move.
Insides seen here:
https://www.ranger-forums.com/genera...1-models-3747/
But parts do break and there are no replacements so best bet is to get manual hubs.
This is a conversion article but worth a look just to see where all the parts go:
Automatic To Manual Hub Conversion : The Ranger Station