If a child on shared custody / cyclical visit is not getting sent back / coming back right at the end of the visit, just either invite the other parent / the child on lot, reload your household or load the household with the child. – more detail on custody visits (cyclical / shared custody): those might fail to send the kid back right away a bit more often. There is also an interaction to ‘ send child back early’ or ‘get child back early‘ which can also be used for that, if you don’t want to invite sims or reload etc.
You could also travel, reload household, etc, the kid will transfer no problem.
If a sim is at work or something else at the time of transfer, and prevents the transfer from happening, no worries! Invite on lot the other parent and the child will transfer back. – more detail on custody visit (timed): timed one-time visits are extremely effective at sending the child back to its starting household. Don’t panic, there are plenty of fail-safe systems built in so that the transfer will be attempted again until it goes through. – General note about custody visits: Many things in the game may happen to make it so that a child will not transfer back exactly at the planned time, because the process could not happen right then.