Duplicate songs in iTunes
Duplicate purchases
If your duplicates are purchased items, and one of the tracks of each pair has a cloud download symbol, then try signing out of the iTunes Store and back in again to resolve. If you have iCloud Music Library as part of Apple Music or iTunes Match turn that off before signing out and then back on after you sign in. It may also help to close iTunes (Music in Catalina or later) after signing out and before signing in again. If you still have cloudy duplicates you may want to remove the downloaded item and then download the cloud item or hide the purchased item from your purchase history.
Why do I have duplicates?
iTunes or Music may create duplicates if the same content is repeatedly added from outside the media folder when it is set to make copies of anything that is added to the library, or is added from an external drive that hosts the media folder if it was offline when iTunes or Music was launched and then is later brought online. In this case the application may not correctly identify that some of the imported items already exist in the library and should be ignored.
Apple's former advice on duplicates is here: Find and remove duplicate items in your iTunes library (archive copy). It is a manual process and the article fails to explain some of the potential pitfalls such as lost ratings and playlist membership, or that sometimes the same file can be represented by multiple entries in the library and that deleting one and recycling/trashing the file will break any others. On a Mac there may be added confusion as iTunes/Music might still be able to play files in the trash until it is emptied.
Apple Music/iTunes Match
If you have iCloud Music Library as part of Apple Music or iTunes Match enable the iCloud Download and iCloud Status columns in the Songs view of your library. You should be able to identify the tracks that are considered have an iCloud Status of Duplicate and remove only those without affecting your other devices or libraries using iCloud Music Library. You might want to check to make sure the duplicates aren't better versions of the tracks they match with before removing.
Removing duplicates
When trying to identify duplicates start with File > Library > Show Duplicate Items and then click Same Album to display exact duplicates as this is normally a more useful selection. You need to manually select all but one of each group to remove. (On a Mac you may need to hold down Option to use File > Library > Show Exact Duplicate Items.) Sorting the list by Date Added may make it easier to select the appropriate tracks particularly if used immediately after the dupes have been created. If you have multiple entries in iTunes connected to the same file on the hard drive then don't send to the recycle bin/trash. If you don't see duplicates that you expect to see then it may be that minor differences exist such as a disc count of 1 in one copy of album which has a blank disc count in another, or there are two alternate versions of a band's name. Ensuring that you tag your albums in a consistent fashion will make it easier to spot and then remove duplicates.
Use my DeDuper script (Windows only) if you're not sure, don't want to do tackle deduplicating by hand, or want to preserve ratings, play counts and playlist membership. See this thread for background on the script, this post for detailed instructions, and please take note of the warning to backup your library before deduping. The most recent version of the script can tidy dead links as long as there is at least one live duplicate to merge stats and playlist membership to, and should cope sensibly when the same file has been added via multiple paths.
Mac users can try Dupin from Doug's Scripts.