(Click the character infographic to download.)
Saruman is (or was) the leader of Gandalf's order, the Council of the Wise. He is also well-known as an expert in Rings of Power – unfortunately, that is, since all that studying of Sauron’s arts leads to Saruman’s own downfall. After spending so much time trying to think like Sauron, Saruman eventually decides to give up and join him, or to even become a Dark Lord in his own right.
Unfortunately for Gandalf, he only discovers Saruman's betrayal when he actually goes to Orthanc, Saruman's tower, to ask for his advice on the matter of the One Ring. Saruman starts out by trying to tempt Gandalf over to the Dark Side. He promises, "the Wise, such as you and I, may with patience come at last to direct [the Power's] courses, to control it. We can bide our time, we can keep our thoughts in our hearts, deploring maybe evils done by the way, but approving the high and ultimate purpose: Knowledge, Rule, Order" (2.2.156). Basically, he is promising Gandalf that, if he joins Sauron's side, the two of them may be able to persuade Sauron to follow their advice. In time, in fact, perhaps they will call the shots.
So even before Saruman and Sauron have conquered anything, Saruman is already planning to betray Sauron. Once he decided to turn against the Council of the Wise, we guess that betrayal has become a habit of his. Of course, Gandalf says no and Saruman locks him up; now he just wants to know the current whereabouts of the Ring.
The Problem With Insane Delusions of Grandeur: You Overlook the Details
Saruman's undoing in The Fellowship of the Ring is his own arrogance. He thinks Radagast the Brown is a complete fool, and so does not worry about the fact that Gandalf has spoken to Radagast recently. But in reality, Gandalf has asked Radagast to use his bird and beast friends to get news of the Nazgûl riding through Middle-earth. One of these friends of Radagast, an eagle called Gwaihir the Windlord, flies up to Gandalf's perch in Orthanc with news. And voila, this eagle carries Gandalf from Orthanc to Rohan, where Gandalf grabs a horse and rides like heck to Rivendell for the Council.
With Gandalf's escape from Saruman's tower, Saruman's part in The Fellowship of the Ring is complete. But he reappears for major portions of The Two Towers, so don’t worry – you haven’t seen the last of him.
In some ways, Saruman is an excellent foil for Boromir. Both of them fall (Saruman more profoundly, since he has actually joined Sauron) out of excessive pride in their own power. For Saruman, that power is largely intellectual and magical, while for Boromir, it is mostly physical. Still, whatever the nature of a person's power, only one thing matters: if a person loves some aspect of himself too much, he becomes more vulnerable to the dark side. After all, a person can only decide he wants to control other people if he truly believes that he knows best: arrogance is thus one of the roots of tyranny.