They came to Middle-earth in the year 1000 of the Third Age to aid the free peoples of Middle-earth against Sauron. They already appeared old when they entered Middle-earth, and aged very slowly. They were sent by the Valar as guides of great deeds, to set in motion the events that would lead to the destruction of Sauron. They were of the Maiar, spirits of the same order of the Valar, but lesser in power. Sauron himself was one of the most powerful of the Maiar.
Very few of Middle-earth's numerous inhabitants knew who the Wizards really were; the Wizards on their behalf did not share this information. Most thought they were Elves or wise Men. They attracted few questions due to their gentle nature and dislike of direct interference with other people's affairs. In spite of their specific and unambiguous goal, the Wizards are nevertheless capable of human feelings; thus Gandalf treats the hobbits with great affection.
There were five who came to Middle-earth. Two of these, the Blue Wizards, went into the East and do not come into the stories of Middle-earth. The other three were called Saruman, also known as Curunír; Gandalf, or Mithrandir; and Radagast.
Saruman originally had the greatest power of the five Istari and was the head of the White Council. In the year 2759 of the Third Age, he was invited by the rulers of Gondor and Rohan to settle in Isengard. Saruman was learned in the lore of the Rings of Power, gradually becoming corrupted by the desire for the Rings and by Sauron's direct influence on him through the palantír of Orthanc. Eventually he became ensnared in Sauron's power, and assisted him in the War of the Ring until he was defeated by the Ents and Gandalf, who broke his staff and cast him out of the White Council. Saruman's death came at the hands of his servant Wormtongue in the Shire, after the destruction of the One Ring.
During the War of the Ring, it was Gandalf who led the Free Peoples to victory over Sauron. He also defeated Saruman. After the destruction of Sauron, Gandalf left Middle-earth and went over the Sea, along with the Ringbearers and many of the Elves.