>>42936281Menstruation is largely a mystery.
In most mammals, the uterine walls stop swelling unless fertilization occurred, but in humans and a handful of other mammals, the swelling is controlled by the ovaries themselves, meaning the walls keep swelling as if the female became pregnant. This creates an excess of blood and other fluids that're simply too much to be reabsorbed, so they have to be expelled.
Why does this happen? Nobody knows for sure. It's thought to merely be a downside of the ovary-regulated menstrual cycle which has some advantages like the termination of nonviable embryos.