Sorry to tell you this, but the courts don't give a damn about adultery. I would not go into coiurt with this as my only (or main) reason. Yoiu need to prove the child is better off with yoiu. What they will consider in terms of child custody is what is in the "best interests of the child." And what they look at when they consider this is basically everything. First, You did not mention how old your daughter is. In most states, a child's desire is given some weight, ranging from little to a lot. Older children are often given more consideration, with some states actually having an established age at which a child can "choose" which parent to live with. The most obvious thing the court is going to look at would be things like abuse or mental illness on the part of one parent. Assuming you can not actually prove her unfit (and no, adultery doesn't count, unless you can prove you daughter is being harmed in some way, such as being exposed to innappropriate acts, such as your ex and the guy having sex in front of her), then the court will look at who the primary caretaker was. Sorry to say, if your ex was the primary caretaker, and spent most of her time with your daughter, while you were away or working, the court is most likely going to rule in her favor. Also, there might be a presumption against you, as there is still a prevalent atitude that teenage girls "need" their mother. (While boys "need " a male figure.)
I would say that your best bet is if your daughter is at least 13 and will tell a judge she wants to be with you. If you can provide financially, have a stable home, can show prior involvement in her life, you have a chance. Sometimes things as seemingly trivial as smoking can be brought into the battle. ANYthing you can do to be a "better" parent than your ex will be looked upon favorably. However, courts are VERY reluctant to modify an earlier order without GOOD cause, so the question of WHY you did not ask for custody a year ago might be your most difficult obstacle. Be sure you have an answer to this that doesn't sound like you are trying to get back at your exwife, but have your daughters best interests in mind. I would highly recommend getting a father-friendly lawyer, the best you can afford. Sadly, your lawyer can be the difference between getting or losing your daughter. Also, there is a ton of free or low cost info and help out there - use it, arm yoiurself with knowledge, then get the afore-mentioned really good lawyer. This is just what I have learned from a still-ongoing battle, hope it helps.