There are a couple things to look at, most of which have been touched on, but people always seem to forget them.
Location - my sister is a realtor, I've friends that are realtors and I've bought 3 different houses. Everytime the subject of buying or selling a home comes up, the top 3 factors are location, location, location. Why did you buy here and will others agree with your reasons when you want to sell?
Cost of rent vs mortgage, taxes and upkeep - a lot of people don't fully take this into account or they'd probably find the actual rate of return on their home is lower than they thought. Personally, while I don't think home ownership is the best thing in terms of the rate of return, it can add some peace of mind: its yours, especially once its paid off.
Timing - it seems common sense but selling when you want to vs when you have to will earn more. Selling in a recession is bad news, just as buying in a surging market will cost you a premium.
My forays into the housing market have been positive: my first home, I was in a year and was transferred by my employer (broke even in a slow market) and my second home, I was in 9 years and almost doubled my money on it(buhbye mortgages!). At this point, I am in a house I want to be in for the duration but I know things can change. I always try to keep in mind the type of neighbourhood I buy in, the proximity to ammenities, such as shopping and schools, convenience of access, etc.