They usually do it with the help of ultrasound, blood tests, Fetal MRI's. In some cases they might do a needle test like amniocentesis or CVS to take samples of the amniotic fluid/placenta so as to study the baby's chromosomes or know the infection status.