We learn how to mirror at a very young age as shown here.  As we get older it gets complicated, but all the basics are the same.  As grown ups we might call it empathy, or recapping, listening, or curiosity, but basic verbal and non-verbal mirroring of another will get you far in developing communication skills.