It's important to understand that a defense mechanism is not necessarily an unhealthy thing. Defensive psychological strategies are a logical response to a perceived threat, though they may be mature or immature, and they may become counterproductive as they outlive their usefulness.
There are many ways people can experience identification, and many types have been described in literature on psychology. Not all identification is a bad thing. Children tend to identify with their parents' values. Being able to identify with others who are like them or share their interests can help them make people into allies rather than enemies. Unconsciously imitating the personality and habits of others can be a great source of growth if the role model is an appropriate one. But there are times that identification is seen as unhealthy rather than a part of normal development.
Anna Freud discussed identification with an aggressor as one of the two "original" defense mechanisms, in opposition to altruistic surrender. Identifying with something that causes anxiety can be a normal part of development in children, helping them to deal with that anxiety. However, in traumatic situations, identification tends to be much more intense and have seriously unhealthy effects. It can contribute to Stockholm syndrome, which, although it may help save a person's life in a dangerous situation, can also cause them to start acting like their captors or abusers, as in the famous case of Patty Hearst. Even more difficult to fathom is how identification with the aggressor can also cause victims of violent crime to retaliate on innocent people in an attempt to deal with the trauma they have experienced, or cause abused children to grow up to continue the cycle of abuse themselves.
Though this behavior may seem cruel and illogical, it's important to remember that no defense mechanism is necessarily a conscious, purposeful behavior. Rather, it's something that people do unconsciously in order to keep from having to deal with their own uncomfortable feelings. Not only that, but the human capacity to cooperate with an aggressor may help a victim survive in a life-threatening situation. It's the continuation of this behavior after the danger has passed that is considered unhealthy. A person going through this will often project the aggression they are unconsciously modelling onto a therapist. This is why it's necessary to be aware of how identification works. Identification, for better or worse, is something people do, and anyone experiencing it needs to be made aware of this in order to work on changing their behavior. Therapists and others who understand that they may have done the same thing in the victim's place already have a special insight into the problem.