Luckily, copyright does not last forever. Eventually, everything falls into the public domain. How long it will take to get there depends on two main factors: where the piece was published or recorded, and when it was created or recorded
Copyright is governed by individual countries rather than by international law. However, there are some notable treaties such as the Berne Convention, which attempted to standardize copyright law for all countries that sign the treaty. The U.S. has very specific laws, which are somewhat more complicated than other European countries. Most countries’ policies are that copyright lasts for the author’s life + 50 or 70 years. A good resource for understanding the basics of different countries’ copyright lengths (believe it or not!) is this Wikipedia article. Many of these country's copyright laws are retroactive, meaning they apply to all works before the law was put into effect, so you likely don't need to research the country's history of copyright. However, some countries have individual Wikipedia articles for their copyright laws, should you want to confirm this.
In the U.S., when a work was published is crucial in determining how long copyright lasts. In some cases, it is even more important to see if the registration was renewed. Cornell University created a chart to help understand when works will fall into the public domain. The basic idea for works published in the U.S. is the following:
The rules are more complicated, but this is the basic jist of it. I recommend you look at the aforementioned chart made by Cornell for more exact rules.
It is important to know that sound recordings are different from compositions and that the law about this has actually changed in October of 2018 with the signing of the Music Modernization Act. The aforementioned chart will eventually be updated, but keep this in mind if you are trying to figure out whether a sound recording is in copyright or not. Information about sound recordings can be found in the "Sound Recordings" tab on the left.