What happens, mentally and physically, after a miscarriage and how long do these effects last?

The aftereffects of a miscarriage, defined as the loss of a pregnancy before 20 weeks, depend on how long a woman was pregnant, and, to some extent, how much she wanted a baby.