I really like David Richo's Five A's
(from How to Be An Adult in Relationships
): attention, acceptance, appreciation, affection, and allowing. Basically: paying attention, accepting them as they are, appreciating what they do, showing them affection, and allowing them to be who they are.
I think that's the basis for a healthy relationship. But it doesn't answer the question of why one person becomes interested in another person in the first place (much less how two people who have similar levels of interest find each other). It's entirely possible to show the Five A's toward a person without their feelings being reciprocated. And most people do not go around with a conscious, intentional policy of trying to show everyone this level of attention.
Most people become interested in another person unintentionally. Something about them attracts their attention. Appearance is the most common way to capture a person's attention (though when it comes to platonic friends, "appearance" refers more to subcultural signifiers -- clothing and hairstyles, etc.). It's no coincidence that we use "attractive" to describe a person that attracts and holds our attention. Beyond that initial attraction, though, it's much harder to determine why the initial interest grows or diminishes. (Which is what my previous post groped toward.)
I thought more about what I wrote in my previous post as I was trying to sleep and realized just how completely inadequate it is. There really isn't a way to explain how or why two people come together and become friends. It's pretty much a fluke when it happens. People are very strongly attracted to any strong display of positive traits they esteem (ie. we're attracted to people who impress us) so the more impressive traits you have, the more attractive you tend to be. If you have a lot of traits like that, and you're good at intentionally applying the Five A's, you might be able to create and sustain friendships at will. But I don't believe there are very many people like that. Most of us can't create friendships at will regardless of what we do.