The first and the last being evil, and the second and third good, the judgment required is to discern the cause of a given impulse. Although some people are regarded as having a special gift to perceive this by intuitive light, most people are regarded as needing study and reflection, and possibly the direction of others.
Ignatius Loyola cited two signs to judge: evil spirits act on the imagination and the senses, and the good spirit, upon reason and conscience. Then, they can be judged by their mode of action and by the end they seek.