In Orwell's 1984, O'Brien knows well that Julia and Winston are enemies of the Party when they come to his house to pledge their allegiance to the Brotherhood. Why doesn't he immediately arrest them then? In the novel itself, there's quite a gap between the actual arrest and the original meeting between Winston and O'Brien.
Most likely he wanted to crush Winston's spirit. Look at it this way:
Winston has an affair with Julia.
He begins to think there's a chance of a successful rebellion.
He's finally feeling good about life.
And BOOM! all his dreams are crushed when he's arrested, especially knowing that he was observed. The Party doesn't just want to stop him, they want to crush his spirits also.
From the book:
Winston shrank back upon the bed. Whatever he said, the swift answer crushed him like a bludgeon.
He could also have been seeing if Winston and/or Julia would lead him (O'Brien) to more traitors, to stop them also.
As well as Riker's answer, which focuses on why O'Brien would wait so long from the point of view of crushing Winston specifically, there's also a different motivation which applies regardless of whether a personal victory over Winston is really seen as an important goal.
It's common practice, for an intelligence officer who's detected one or two possible targets to entrap, not to detain them immediately but to wait and observe them in case they lead him to more subversives. Why stop at a single rogue element if you might be able to catch a whole nest of them? Knowledge of a single person's rebelliousness is an asset, but only as long as that person doesn't know you know: as soon as you capture them, they become nothing but another imprisoned soul, and no use in helping you to find more.
(This answer is partly inspired by DVK's answer to the related question Why doesn't Mr. Charrington turn Winston in earlier? on another SE site.)