Mechanical royalties are generated whenever a copy of a song it made. Some examples of this are when a label produces CDs, someone digitally purchases your song, or when your song is streamed. These royalties must be paid by a third-party (usually a record label) for the use of the song.
The current standard (or statutory) mechanical royalty rate for physical recordings (such as CDs) and permanent digital downloads sold in the United States is 9.1¢ for recordings of songs 5 minutes or less, and 1.75¢ per minute or fraction thereof for those over 5 minutes. The total mechanical royalties paid will then be those rates multiplied by the number of copies made. To learn more about the statutory mechanical royalty rate, please visit Harry Fox Agency.
Please note that the mechanical license rate varies depending on the territory/country your song is distributed in.
In addition, streaming rates are not statutory, so each streaming service pays out a bit differently and each one has their own calculation to determine the rate along in addition to their own multiple factors that would effect each song's rate.
This diagram helps break down the flow of mechanical royalties: