بسم الله الرحمن الرحيم
The detail regarding child custody for mother is that the son shall stay with his mother up to 7 years of age while the daughter up to 9 years of age provided the mother has not married someone else. If the mother marries someone else then her right of custody shall nullify. But if after marriage she is separated from her husband after talaq then she shall become eligible for custody and her custody right shall return again.
Allah knows Best!
Darul Uloom Deoband
This answer was collected from the official ifta website of Darul Uloom Deoband in India.