I've wondered about this because having AS I'm supposed to lack empathy, but it's not one of the traits I feel I really lack.
I have heard empathy is linked to imagination, and that people with autism lack one because they lack the other. If you can't imagine what it's like to be someone else, can't imagine something you haven't directly experienced, they you can't empathise.
I don't have problems with imagination, despite being AS in so many other ways, which would seem to fit with this.
I have terrible trouble understanding other people's thoughts and feelings and actions on one level. But I can recognise that people feel differently from me. And I can recognise that sometimes people feel the same thing I'm feeling, too. I think that's the first stage of empathy - recognising other people's feelings.
Being able to imagine what it's like to feel as another person does - even without direct experience to go on - is the next stage. This is harder for me, but I can often do it, especially if I try to summon up situations that are perhaps a little similar. Or I try to imagine how I'd feel if I'd had different experiences. Or if I'd not experienced something that happened to me - how did my worldview change from that experience? I imagine how, if I lacked that experience, I might not have the same feelings about something that I currently do. Then I can imagine how another person who also lacks that experience would feel differently.
Sympathy implies feeling sorrow for another person. Empathy has connotations of that too, I think, as the word is used. Not just recognition but, through recognition, the ability to react sympathetically and in an understanding way.