Experience teaches it. It is learned through the body and the spirit, not the mind, which is why advice helps so little. One must allow oneself an education of experience.
Now there are different kinds of spiritual gifts, but it is the same Holy Spirit who is the source of them all.
1 Corinthians 12:4 (NLT)