Just like when it's a man and a woman. Far too often I hear of children going to mentally ill, abusive mothers rather than supportive fathers, its heartbreaking, and I don't see why this should be any different.
If it's just two people not being able to work things out, then blood is an obvious heavy consideration; but if the kid's bio-dad is an *******, and the kid loves and is supported by the other, then why choose to place a child in a dysfunctional home?