To start with the very basics, an amniocentesis is a prenatal test that works by taking a small amount of the amniotic fluid, the fluid surrounding all unborn babies, out of the uterus of a pregnant mother. With the assistance of ultrasound, a small and long needle is inserted into the uterus through the abdomen, in order to remove the amniotic fluid. A range of tests can then be carried out on the collected sample. Amniotic fluid contains live fetal skin cells, and it can be used to get a lot of information about the fetus. Analyzing it can give conclusive information about many birth defects. Reliable prenatal testing for Down Syndrome comes to mind immediately, but an amniocentesis gives definite answers about many other things too, like cystic fibrosis, and even gender (not that you'd have one because of that!).
Unlike other prenatal tests, an amniocentesis gives certain and reliable results. It is often recommended after women have had an ultrasound that raised concerns, a history of birth defects, or are of "advanced maternal age" over 35. Those who opt to have an amniocentesis usually undergo it between 15 and 18 weeks gestation. Having an amniocentesis means that increase the risk of miscarriage, and the procedure can potentially injure mother or fetus, and lead to an infection. Those women who undergo an amniocentesis should rest for a few days after the procedure, and will get results several weeks later, after lab analysis.