Itachi and Nagato had a dark twisted way of thinking if you ask me. Itachi preached reality, preconceptions, assumptions, etc. and that is all very smart but really made a mess of his brother. Nagato preached growing through pain and learning from pain just to change his mind after countless years of living his philosophy.
Who is the smartest of the three? Jiraiya! Why? He experienced war like Nagato yet kept his pure heart and hope. There's much more to life than pure logic (Look at Naruto). He also didn't try and manipulate others future "For their own good" or however you want to justify what Itachi did.
Gaara is intelligent too though. He is a young wise character but not as developed as Jiraiya. He is like an unbiased intelligent character that serves as a slap to the face for the older kages.