The custodial parent (the one with whom the child spent the most nights) gives a signed 8332 to the other parent which allows the other parent to claim dependency and child tax credit. The custodial parent always retains the right to claim earned income credit, child care credit and file as Head of Household if otherwise qualified—no matter which parent claims the dependency.
It's relatively simple. The parent who has actual physical custody more than half the nights of the year is the only parent who can automatically claim the child as a dependent. You must actually count the nights the child lives in each home if it is close, the IRS is controlled by Federal law which supersedes a state court order; there is no such thing as "50/50 custody" for the IRS, you have to count nights.
(For a leap year, it is possible for custody to be exactly equal, 183 nights each. In that case, no one has custody more than half the nights of the year. The parent with the higher income gets to claim the child as a dependent, and no one qualifies for EIC or HOH, since exactly half is not more than half. For normal years with 365 days, more than half is 183 or more nights, and less than half is 182 or less.)
Then, if the custodial parent is required to allow the other parent to claim a child as a dependent for a certain year, the custodial parent must give the non-custodial parent a signed form 8332. You can do this each year it is required or you can put all the years on the form so you only have to provide one signed form.
In any tax program, the custodial parent will say they had the child more than half the nights of the year, but they are releasing the dependent to the other parent with form 8332. The non-custodial parent still gets to use the child to qualify for EIC or head of household status because that stays with the custodial parent and can't be waived, shared or transferred. The other parent will tell their tax program that the child lived with them less than half the year and they are getting a form 8332. Their tax program will give them the dependent tax credit but not HOH or EIC. After e-filing, the non-custodial parent must mail the signed original form 8332 to the IRS along with a cover page that their tax program should tell them to print. If they have a multi-year 8332, mail the original the first year and copies thereafter.
These special rules dissolve when the child is emancipated -- usually when they turn 18, although the age of emancipation is different in a few states, and neither parent can claim the child at that point.
If you actually change the child's living arrangements so that the child lives with parent #1 183 or more nights one year, and lives with parent #2 more than 183 nights the next year, then the parent where the child lives doesn't need the form to claim the child.