Scout is actually a girl, and much more wordly than other girls her age. She does not feel it is necessary to behave according to what society views as the norm. Atticus has given her the basis for her humanity and compassion. She is a worry-wart. Philosophical and moral issues weigh on her- the bigotry she is now a witness to in her own town causes her to reflect on Tom's plight, as well as Jem's reaction to it.
Well, first of all, Scout is a girl. Her real name is Jean Louise. She is able to put herself in others' shoes because her father, Atticus, has raised her in an atmosphere of empathy and fairness. Atticus sees all people as individuals, often victims of their circumstances. And their circumstances have little or nothing to do with their character.
Important also to understanding Scout's empathy is Atticus' instance on fairness. For example, when Scout asks if her family is poor, Atticus responds this way:
Atticus said professional people were poor because the farmers were poor. As Maycomb County was a farm county, nickels and dimes were hard to come by for doctors and dentists and lawyers. (Chapter 2)
Through the example of her father, Scout is able to emulate values all too uncommon in society.
Scout puts herself in someone else's shoes through a mix of intuitive intelligence, empathy, and training. Her training comes from being blessed with a father like Atticus, who taught his children to have open minds, exposed them to multiple arguments, allowed them to go to church with Calpurnia (thus seeing how others society sees as different live), and to respect others. He actively guided Scout to be sensitive to the feelings of others, and she does so.
Some of it, though, seems to be natural. When she speaks up for Walter Cunningham, she seems to be acting instinctively, and when her imagination conjures up an image of what Boo is like, no one is guiding her.