You could try the following all-purpose steps for dealing with erratic device or sync behaviour. They assume that all of the content you want on the device is in your library ready for restoring. If it isn't see Recover your iTunes library from your iPod or iOS device first. I would also recommend you copy everything out of the camera roll if you haven't already.
- Backup device to iTunes.
- Restore as a new device.
- Restore the backup you made earlier.
Use an encrypted backup (*) if you want to preserve passwords, Wi-Fi settings, web history and health data where appropriate. I also suggest syncing with a selection of playlists (unless you're using iCloud Music Library) rather than manually adding content as, if nothing else, the process above is easier to do if you ever have to go through it again.
(*) The downside with backup encryption is that if you forget the password when you need it again, which could be years later, you may need to invoke a workaround to turn off encryption as shown in Disable iOS backup encryption, which can only help if your device is in a state that can backup to iCloud or is running iOS 11.