SPOILER ALERT!
N is an orphan. Ghetsis raised him. Ghetsis tricked N into believing that Poke'mon are good, and people are scum, by raising him only around Poke'mon. This aided Ghetsis's plans, because it meant that N would support him when Ghetsis was supposedly saving Poke'mon.
In Black and White N wants to see who is stronger, himself, or the player, wanting to see if he can succeed with one of the Legendary Poke'mon by his side. His plan was, if he were to defeat the main character, to further the plans Ghetsis supposedly had(liberating Poke'mon for their own good), and "save" Poke'mon from humans. N later realized in Black and White that Ghetsis wasn't actually helping Poke'mon, and defied him. Later, in Black and White2, N further defies his father by teaming up with the main character. N has the rare power to communicate with Poke'mon, which may be because he spent his whole live with them. Although N now realizes that not all people are bad, he still has a very low opinion of them.