Praise be to Allah.
The scholars differed as to the maximum extent of nifaas (bleeding following childbirth). The majority of scholars were of the view that it is forty days after giving birth.
See question no. 10488.
Based on this, then for a woman whose bleeding lasts for more than forty days, if this blood coincides with her regular menstrual cycle, then she is menstruating; if it does not coincide with her regular menstrual cycle, then it is the blood of istihaadah (irregular non-menstrual bleeding), so she should do ghusl after forty days, and fast and pray. She is taahir (pure) and comes under the same ruling as other women who are taahir.