This is how it is intended you do it:
Moving a library: Quick answer if you use iTunes' default preferences settings: Copy the entire iTunes folder (and in doing so all its sub-folders and files) intact to the other drive, hold down the option/alt key (shift on Windows) while starting iTunes, and when requested to select a library select the iTunes Library.itl file in the copied folder. https://support.apple.com/HT201596
When this is to a new drive/computer put the copied iTunes folder in the default location of Macintosh HD > Users > *User Name* > Music (or Home > Music) then you don't even need to start with the option key held down, iTunes will automatically look for it there. (Make sure there isn't anything already in the iTunes folder there that you want to keep since you will be replacing it with the one you are moving.) Remember to authorize the computer in iTunes to your Apple ID if you use this to sync to Apple mobile devices or play DRM protected media (e.g., movies).
Certain items used in iTunes related activities are not stored in the iTunes library folder but in special folders. If you are moving a library to a different computer you may wish to copy these too:
- Apple Music cache files: http://dougscripts.com/itunes/2015/09/new-flush-apple-music-cache-files/ - ~/Library/Caches/com.apple.iTunes/SubscriptionPlayCache/ folder, which is sort of like an “iTunes Media” folder for Apple Music
- iOS device backups, various preferences files: https://discussions.apple.com/thread/3285925
Windows users see tip at: https://discussions.apple.com/message/18879381#18879381
Consider moving everything from your Windows PC to your Mac in a single move, including your iTunes library: About Windows Migration Assistant - http://support.apple.com/kb/ht4796 - Learn about how to use Windows Migration Assistant to migrate your files from a Windows PC to a Mac. Additional tip by ChrisCA 05/2014 - https://discussions.apple.com/message/28178940#28178940
Your i-device was not designed for unique storage of your media. It is not a backup device and media transfer was planned with you maintaining a master copy of your media on a computer which is itself independently backed up against loss. To use a device with a different setup you transfer the old library from a computer or a backup directly to the new setup, not the device to the library. Media syncing is one way, computer to device, updating the device content to the content on the computer, not updating or restoring content on a computer from a device. The exception is iTunes Store media purchases which can be transferred to a computer.
Re-download or transfer your iTunes Store purchases from an iPhone, iPad or iPod to a computer - https://support.apple.com/en-us/HT201267 - "This feature works only for content bought from the iTunes Store." As of iOS9 it no longer does apps which now must be re-downloaded directly from the Store.
For transferring other items from an i-device to a computer you will have to use third party commercial software. See this document by turingtest2: Recovering your iTunes library from your iPod or iOS device - https://discussions.apple.com/docs/DOC-3991 Even this method may not fully recover what you had in the library originally. For example if in order to save space when syncing you had converted music files to a lower bitrate, or photos to a lower resolution, it is those lower quality files you will recover.
If you subscribe to Apple Music, tracks which are not part of content you have purchased or uploaded cannot be transferred and have to be downloaded directly from iCloud.