This is a fun guide to how to say hi to anyone you pass on the sidewalk in your neighborhood.
I never really learned the habit of doing this until very recently and found that it actually took some thought and experimentation to do it well. My fiancee and I reenacted a typical scenario you might get on the street. Saying hi to a person of the sex to which you're inclined can be especially fraught, so we took the liberty of adding a few extra steps on what not to do.
Step 1: Be Aware of Your Surroundings
I've found that the most common reason I don't say hi or smile at people I pass on the street in my neighborhood is that I'm staring at the ground or otherwise consumed with my own thoughts, and so I'm not aware of other people. I am mostly likely to get lost in thought or routine to and from the train to work.
So the first step is simply remembering to look up and around. Stop staring at the sidewalk. When you do that, you'll become aware of the people you'll soon be passing. The other part of this step is to generally direct your field of vision in the direction of people passing.
Step 2: Make Eye Contact and Smile
When you have people in your field of vision, it's much easier to catch their eye in a natural way. When you catch their eye, just smile lightly and/or say "hi." Most people seem to prefer a simple smile. Sometimes a nod also helps.
We don't recommend that you wave unless the person is sitting on their porch or gardening or something else far away. You'll look awkward and dorky.
Step 3: Walk Away and Don't Turn Back
After you pass the person with a smile, just keep walking. DO NOT turn back and ogle or otherwise engage the person in conversation unless you are completely confident that s/he actually wants to talk.
Step 4: Remember Not to Do Any of the Following...
Glare at someone to make sure that they make eye contact.
Say hi before you're in comfortable eye contact range.
Get in someone's face.
Turn back and profess undying love.