Identification is the imprinting process seen in a child toward its same sex parent, and causes the internalization of both virtues and vices of that parent with similar gender instincts (usually the boy toward his father and the girl toward her mother.) This process is typically one that happens toward the end of what has been called the Oedipal period of childhood. That is where, after overtures of possession and admiration for the opposite sex parent - and coming to the realization that they will not be able to "marry" that parent - the child eventually comes to terms with the practical strategy that absorbing some of the nature of the same sex parent will be an effective way to find a similar connection to the opposite sex.
This is not a conscious conclusion, but like any imprinting phenomenon, is an unconscious, instinctual process that is waiting to be turned on.
In addition, outside the area of romance, identification is a general defense mechanism or ego defense (an unconscious and universal social habit) that is on the adolescent spectrum of these automatic social behaviors. It is seen in "hero worship" and "celebrity," where we see traits in a well-known or accomplished person that we aspire to, or traits that we actually, already have inside ourselves, but which the admired person has done more with in life, than we have. And so we "identify" with them, admire, take in, and perhaps even mimic their behavior.
The usefulness of the imprinted instinct to identify with the same-sex parent rests in it being a way of taking in the various traits of character which our own, opposite-sex parent must have once admired and been attracted to. To the logic of the instincts, the best way of attracting a person who is much like our mother would be to act like our father, and the best way to attract someone similar to our father is to act like our mother.
None of this is conscious, of course. It is automatic and has evolved in our species for many thousands of years, to guarantee our survival and reproduction, in the most efficient ways. If not for our ability at identification, we couldn't be our "real selves" in romance, nor could we have such rich and automatic guidance from those who came before us down the same path.