The $64,000 question!! How do I find a great agent?
The best way, as many have already answered, is through a referral from a friend or family member who've already found a great agent, and can pass that name along to you. Make sure that the friend or family member you've taken the referral from is someone who's opinion you respect.
If you don't have that referral, I would strongly suggest visiting Open Houses, and meeting agents who are sitting those Open Houses. Often the agents who are hosting those Opens are not the listing agent. They are agents who are looking to increase their business (in other words "hungry agents") who are out there to meet and greet the public.
Take your time, ask a few "general questions" about the market, and how's business. Get the agent talking a bit about themselves, it shouldn't be difficult, there are very few "shrinking violets" in this industry and we love to talk about real estate and about ourselves. After you've been to a fair number of Opens, you'll begin to get a feel for the type of agent you like and click with. Some of the agents you may run into more than once.
When you've found 2 or 3 that you think you may like, it's time to narrow the field. If you're selling, hopefully, you've been attending open houses, similar to the type of property you're going to sell. (if not, start again) Interview each of those agents, and get a feel for their personality, their marketing plan for your property, have them produce a CMA (Competitive Market Analysis) for your home. Ask them pointed questions. What would you price our house at to be sold quickly? How quickly do you think we could sell? What would you recommend if we're still unsold in 30 days, 60 days, 120 days? Where will you advertise and why? What's your internet presence? How reachable are you? How often will you upate us? You get the idea.
For a buyer's agent, the process is different. Find the 2-3 that you like and tell each of them, that you'd like the to put you on their e-mailing list and begin sending you listings that might fit you, and begin going out to see properties with each of them. Let them all know that you're going to be "Testing" 2-3 agents for the next 4-5 weeks (be upfront), and you'll be hiring the one that impresses you and fits best. And then stick to that... don't drag 2-3 agents around with you for months and months... it's not fair to all involved.
Good luck and have fun!