On my truck, a 2001 Ranger, I first have to remove a little plastic plate that is above the headlight. It comes off after removing three small bolts on top. Remove that plastic and you’ll find two metal tabs behind the headlight housing (the glass part). If you pull up on those they will release the housing, and after a little bit of wiggling you’ll be able to get the housing out, and get at the rear of the housing is where you’ll find the retaining ring that holds the bulb in.
Unscrew the retaining ring (I think it only needs about a quarter turn), pull out the bulb and detach it from the wiring harness, replace with the new bulb, re-insert it back into the housing, and secure it in place with the retaining ring. Now you have to wiggle the light housing’s threaded rods (there are three) back into those tabs that you released to get it out. The threaded rods can be moved around to make this easier. When the housing is back in place, you’ll be able to see these little plastic things sticking out of the tabs, push back down on the tabs to lock the housing into place. Make sure that the housing it secure and doesn’t move around, if it does it means you didn’t get it back into place well enough. Replace the plastic plate on top and you’re done. The procedure for both headlights is essentially the same.
At first I was thinking to myself “This is so stupid and typical of newer cars.” But after I figured it out, it’s pretty easy to do. The second headlight only took me about 5 minutes.