To transfer music from an ipod to your computer (I'm assuming you're on Windows) - (1) go to my computer (2)find your ipod there, and click on it (3) go to tools, folder options (4) click on the view tab, and select "show hidden files and folders", then press ok (5) now go back to your ipod folder, and click on "ipod_control" (6) then click on "music".
Now your music is spread out through all of those F folders. Now leave that window open, and go to my documents - my music. You'll have to open each one up individually. For each F folder, highlight all of the songs and drag them to your my music folder. Dont worry, you wont remove any of your music off of your ipod.
After you've copied everything, go into itunes and add music to your library like normal. I hope that helps!

[edit] Ooops, I guess someone already explained everything.