Deductions & credits

The parent who has actual physical custody more than half the nights of the year is the only parent allowed to claim the children as dependents, regardless of any court order or "50/50" custody.  The IRS is governed by federal law, which is superior to state law and state courts, and the IRS requires you count the actual number of nights.

 

The non-custodial parent can only claim a child if the custodial parent gives them a signed form 8332 dependent release, and even with that form, the non-custodial parent can claim the child tax credit but not the dependent care credit, EIC or head of household status.  Those tax benefits stay with the custodial parent and can't be waived, shared or transferred.

 

It seems likely that your ex claimed a child incorrectly if you have not been giving them a form 8332 (they would have to have claimed that the child lived with them), and you may have been denying yourself tax benefits if you paid for day care so you could work, or if you qualify for EIC.  You may want to discuss filing amended returns for 2018 through 2020 if you have missed tax benefits.  If you file an amended return to change the status of child #2 to allow you to claim more EIC or dependent care credit, that may require your ex to file an amended return to remove those claims.