Laws vary from country to country in details (e.g. number of years a copyright is valid, the ways it can eventually be prolonged, weather the author is till alive or not influences the permanence of the copyright, etc.), but the distinction between an original work and a derivative work is more or less common.
In our case an original work would be a musical composition in written form. A derivative work would be any rendition or presentation of the composition, including a typesetting of the score for publication, an audio or video recording of a performance, an arrangement different from the original, an incorporation of parts of the original work (as in sampling), etc.
Let's say the copyright for the composition has expired. Then you can freely perform it publicly, reuse it in your own compositions or arrangements, record and sell performances of it, without having to pay royalties to the (former) owner of the copyright.
But if, for example, you record and commercialize an audio CD with a performance, YOUR performance is copyrighted and it cannot be copied or publicly played without you (or the actual owner of the copyright, if it is for example a record company) being payed royalties.
The same principle applies to other derivative works, like score editions and arrangements. If such derivative works are still under copyright, you can't (photo)copy the score or perform the arrangement without paying due royalties. But nothing stops you from doing your own typesetting or arrangement from the original work (if it is no longer copyrighted).
If the derivative works are no longer under copyright either (like the many scores fortunately available in IMSLP) then you can also reuse them freely.
So, in simple terms, you can't legally photocopy a recent copyrighted edition of the score for Beethoven's 5th Symphony, the same way you can't copy CDs of last year's recording of that symphony by the London Philharmonic.
But you can of course use the copyrighted score to publicly perform or record the symphony yourself (that's the end purpose of a score, to be performed).
And you can go to IMSLP, download one of the out of copyright editions, and use it to typeset your own edition for your own special purpose and even publish it and commercially sell it. You can even it copyright it, as long as it incorporates some intellectual work on top of the original work. E.g. you couldn't copyright a simple fac simile edition of the score, but if you do a completely new typesetting, that's a valid derivative work.
Note that if one plans to use material for widespread publication (even if not commercial) it's one's own responsibility to make sure of the public domain status. IMSLP certainly does not take responsibility for that, in fact they insist that each uploader asserts the lawfulness of the sharing. But they give a pretty good simple guide on copyright that is surely of help.
However, particularly for not so old material, asserting the public domain status may entail hard work contacting publishers and rights management agencies, which is generally done by professional agencies.
Which of course means in our Internet age that there's definitely a risk that some material in IMSLP and other crowd-sourced sites is copyrighted .