Apple, for the last few years, will let you “trade in” an older model of one of their products. This can be done at any time, not only when you’re purchasing something new; they’ll give you a gift card with the value of the trade-in.
To see what they’ll give you for your old stuff, go to this page: Apple Trade-In
Scroll down to the middle of the screen, to where it says “Trade In And Get Apple Gift Card Credit.” Immediately beneath that, click your device type, and enter its serial number, which the page will tell you how to do. You can then choose whether you want to take your old device to an Apple Store, or you want an empty box shipped to you and conduct the trade in by mail.
What Apple is offering here is convenience — it’s safe to say what you’re going to get is well below the fair market price. But if you’ve got old Apple stuff sitting around gathering dust, you’ve got little to lose by trading it in.
Make sure that you fully erase the device before you give it to Apple — on iPads and iPhones, this is easily done under Settings > General > Reset > Erase All Content And Settings. Macs are considerably more unwieldy; see Apple’s instructions on What to do before you sell, give away, or trade in your Mac. Make sure to complete step 7, which itself links off to more instructions. (The forthcoming macOS 12 Monterey finally simplifies this process.)
Image of vintage iMacs at TekServe by Shinya Suzuki, courtesy Flickr Creative Commons.