It was while doing some extra reading for a practice essay for her N.E.W.T.s that Ginny first stumbled across the old theory of the four elements. She had learned enough from Hermione that she knew there was no basis for it in the solid Muggle world of physics, but she thought perhaps in Wizarding reality it might be different. Avid to know more, she searched the Hogwarts library and found more than twenty books on the subject. Some of them were quite old, but she read them anyway.
Her conclusion was that it was a useful way of conceptualising both objects and people. For people especially, using earth, air, water, and fire as personality descriptors seemed reasonable to Ginny. Not that a given person was likely to be entirely described by just one of those elements, but traits associated with one or two might well predominate, and that could help you figure out if another person might be complementary to you, or not.
Thinking along those lines made her realise that her attraction to Harry wasn't well-founded; they were different but not in ways that meshed well. Next Ginny considered the other boys that she knew. She thought that she herself was mostly fire and air, with earth as a strong sub-current, so she would probably do well to find someone with earth predominating, some water traits, and perhaps a little fire.
After careful consideration, she sent a note to Neville, asking if he'd like to have lunch with her sometime. His reply came by return owl: "I'd love to."