How does the doctor know your baby died at 8 weeks in the womb?

Dr. can detect by checking the heart beat of the baby, and also when the baby is not kicking the mother will also know