I have found that factory shocks are typically good for about 50K miles. There are exceptions though. My Ranger came with Bilstein shocks and they were good for about 100K miles.
I can usually tell if the shocks are bad when driving it. When hitting a dip it should bounce once and recover quickly without several rebounds. I usually check by pushing down on one end of the vehicle several times and get it to bouncing up and down. Then stop pushing it and see how many times it bounces before it stops (or near stop). It should stop within 1 to 1.5 cycles. If it bounces more, you need shocks. Even 1.5 cycles could be an indication of needed new shocks. Many people don't believe in this method but it works if done right.
2002 FX4 Bright Red Supercab 4.0 SOHC, manual 5-spd & Tcase, 33" BFG MTs, K&N air filter, Modified air box inlet, Gibson SS cat. back exhaust, Bama flash, Hidden Hitch round receiver, Rear helper air springs, Electric trailer brake controller, Line-X bed liner, WAAG bar with KC lights and Wildernest shell.