Before you start crawling under the truck to bang on the shift motor, make sure that the proper procedure is being used to get it out of 4wd. With the vehicle running, depress the brake pedal and put the truck in neutral. While keeping the brake pedal depressed, push the 4x4 lo button. It should click and the light should go out. You can then push the 4x4 high button and it should go into 2wd. To go back and forth between 2wd and 4wd hi, you don't have to put the truck in neutral and step on the brake, you can do it anytime, but to get it in and out of 4lo, the truck must be in neutral and the brake must be applied.
The 4wd shift motor is located on the rear of the transfer case under the truck. The transfer case is bolted to the rear of the transmission, and has both the front and rear driveshafts running to it.
BTW, if you get it back into 4hi and it still won't go into 2WD, you can still drive it safely on the highway. When you twist the hubs back to "Free", it disengages the wheels from the axle. You will effectively be in 2WD, but the drivetrain will still be turning.
Good Luck!