Peace be upon you. According to Grand Ayatollah Sistani, the blood a woman sees before childbirth is considered menstrual blood if it meets the conditions of menstruation (such as lasting three days and not being preceded by menstruation within ten days of purity). If these conditions are met, you do not need to repeat your prayers. Regarding the blood seen after a miscarriage, if the fetus has developed beyond the stage of a 'morsel' (i.e., it has taken on a recognizable form), it is considered postpartum bleeding (nifas), and it is not required to have a minimum period of purity from the previous menstruation. If the fetus has not developed beyond the 'morsel' stage, and there is a separation of at least three days from the previous blood, it is considered menstruation; otherwise, it is considered irregular bleeding (istihada). Grand Ayatollah Khamenei states that if the blood seen during pregnancy has the characteristics of menstruation and lasts for three days, it is menstruation; otherwise, it is irregular bleeding. After a miscarriage, the bleeding is considered postpartum bleeding even if the fetus was at the 'clot' stage, and it is not menstruation. May you be successful in all good deeds.