This is a really good question and one I struggle with sometimes, too. Just the other day I had to unplug and take a walk, listen to music that went with my character, and just ponder why he was the way he was as I walked. I tried to put myself in a small scene that happened to him in the past and feel through what he wanted and what he was ignorant of that came up and slapped him in the face. I pondered what his wants and desires caused him to do, and what the reaction (positive and negative) was on the people around him, and how that ultimately came back to affect him. I second the resources Vijaya mentioned, and I almost feel like some acting resources might be helpful as well. What do actors do when they have to figure out how to inhabit a character who is new to them? Those kinds of things would be helpful for writers trying to figure out their main characters, too.
(But oy, why is it sometimes so much easier to figure out the side characters than the main character??)