Nothing can guarantee the outcome of a criminal case, but hiring an experienced lawyer is a good first step. By experience, I mean someone who has many years -- at least 10 -- of experience handling criminal defense. And they should focus their practice on criminal defense. An attorney who focuses their practice in this area is more likely to know the ins and outs of the criminal justice system. Also, if they appear in the local criminal courthouse often, they most likely have established relationships with prosecutors and judges. This could work in your favor.
Track record of success
Shop around for an attorney who has a track record of success in criminal cases. Even better, find someone who has been successful in your particular type of case. Again, this doesn't mean they will absolutely have success in your case, but it's a good place to start.
Respect for clients
I recommend that you talk to several attorneys in order to find the best one for you. Ask lots of questions. A good attorney will keep their clients informed of the progress of their case, consider the client's wishes in making decisions about how to handle the case, and return phone calls or emails promptly.