Mostly - it's like you identify who you are through someone or something else.
ie someone I care about is sad - therefore I must be sad too
Or
This movie is funny therefore I must be happy and laugh
Or to the more extreme
Someone says "My dad just went to the football game and got in an accident on the way home, I need to go to the hospital." - Therefore - "Wow! Do you need me to drive you there? I know what that's like, how stressful it can be. I hope your Dad is ok. Please let me know if he's ok."
(You take on the emotion and/or imagine yourself in the circumstance of the other person in order to identify yourself and your emotions.)
At least that's the best I can describe it