Sauron had originally been the #1 henchmen to Melkor (the True Dark Power of the First Age) After the defeat of Melkor he became a goodguy for awhile while secretly plotting against them. Thus he was able to work with the elves on how to create rings. Because of his past though the elves still did not fully trust him, which is why they created thier three rings without his help. This is why the 3 Elven rings were never corrupted and still worked even when the One Ring was created. All of the rings, even the Elven ones, though were still tied together in some way so that with the destruction of the One all the others would also cease to work.