What factors are typically important in a court's determination of whether or how much one spouse has to pay towards the attorney's fees of the other spouse?
Family law is a field governed by state law and it varies from state to state. You should consult a family law practitioner in your state if you are dealing with a divorce.
In many states a wealthier spouse will have to pay the reasonable attorney fees and other expenses of a less wealthy spouse until the divorce is complete, because otherwise the less wealthy spouse would be at a very unfair disadvantage in court. A court order may issue early in the divorce process and they may fight over the amount of the fees. It is usually much less important than the fight over the marital assets as a whole, so thinking strategically about what challenges to make or not make is important. Attorney fees of each party can usually also be taken into account in determining what equitable division of the assets will be made at trial.