First off, N's full name isn't just N, it is actually "Natural Harmonia Gropius". And of course, this contains spoilers so don't read ahead if you don't want Team Plasma's motive spoilt!
According to Bulbapedia, N was an orphan who was left in the woods and raised by Pokemon. Ghetsis, one of Team Plasma's Seven Sages, claimed to be his father and raised to him be the king of Team Plasma as the opening theme of Black and White shows (basically it shows Ghetsis crowning N as Team Plasma's king).
Ghetsis kept N away from all humans except himself, and only showed to him Pokemon that had been wounded by humans, brainwashing him and making him think that Pokemon are humans should not live together and that trainers should release their Pokemon. It is revealed shortly before the final battle that Ghetsis had lied and only raised N and Team Plasma this way to create a world where he would be the only one in the Unova region with Pokemon, which would then allow him to take over the region. So essentially, N was Ghetsis' puppet until he was arrested after his final battle with the player of Black/White. N had a complete change of heart following the battle; he forgives you and explains his feelings before leaving.
>"I want to talk to you about something."
"It's about when I first met you in Accumula Town. I was shocked when I heard what your Pokémon was saying. I was shocked because that Pokémon said it liked you. It said it wanted to be with you."
"I couldn't understand it. I couldn't believe there were Pokémon that liked people. Because, up until that moment, I'd never known a Pokémon like that. The longer my journey continued, the more unsure I became. All I kept meeting were Pokémon and people who communicated with one another and helped one another. That was why I needed to confirm my beliefs by battling with you. I wanted to confront you hero-to-hero. I needed that more than anything."
"There's no way a person like me, someone who understands only Pokémon— No, actually… I didn't understand them, either. No way could I measure up to you, when you had met so many Pokémon and were surrounded by friends…"
"The Champion has forgiven me, and… What I should do now is something I'll have to decide for myself."
N returns again in Black and White 2, and this time acts as one of the player's allies and helps you stop Ghetsis from using Kyurem to take over Unova (in fact, if if remember correctly, even risked his life to save you when Kyurem was about to use Glaciate on you).
Bulbapedia has great info on N, click here to check it out.