The most common definitions of 'gender identity' all refer to inner feelings and perceptions that seemingly have no origin and no reason. For example something like this:
One's innermost concept of self as male, female, a blend of both or neither – how individuals perceive themselves and what they call themselves. One's gender identity can be the same or different from their sex assigned at birth.
Or like this:
Gender identity is defined as a personal and internal sense of oneself as male, female, or other.
I think this is underdefined and that 'gender identity' is perhaps better understood as a conflation of desire and knowledge. Those who desire to be the opposite sex in some regard, or at least desire not to be the sex they are, may use 'gender identity' to rationalise that desire into an identity belief. Conversely, those who don't have any such desire, which is most people, will rely on knowledge of their own sex if asked 'what is your gender identity?'. Particularly if it's some sort of questionnaire and the available answers include 'female' / 'male' or 'woman' / 'man'.
Looking at the forums where the trans-identified go to discuss transition, it's quite revealing to see how many of them change their self-description over time, and how this, for example, will often segue from 'I want to be a woman' (desire) to 'I am a woman' (identity).
I believe it helps to view 'gender identity' in this way because it brings more clarity to the underlying process of how such identities are developed, recognised and declared.
Interested to hear your thoughts on this. Please tell me if I'm dead wrong or missed something fundamental.