How to safely store your data recovery keys?

When you encrypt your data on your hard drive or in the cloud, the only way to access it is with the decryption key. Typically the decryption key is safely stored on your device, and made available when you unlock your device, or log in. But what if you can no longer do that? Where do you safely store a backup of this key (sometimes called a recovery key) in case something goes wrong?