The causes behind blood in the urine.

Hematuria is defined as the presence of blood in the urine. Most of the time, the amount is so small that the human eye can’t see it. This is called microscopic hematuria and can only be detected through a urine test. Less often, the amount of blood is greater and the urine turns pink, red, dark brown, or clear with red spots. In this case, it is called macroscopic hematuria.

Although not completely specific, some patterns could suggest different causes:
Red urine only at the beginning of the stream most likely comes from the urethra. It can be caused by irritation due to an urinary tract infection or stones.
Red urine only at the end of the stream, suggests that the bladder or prostate could be the bleeding source. Inflammation or enlargement of the prostate are some of the causes.
Red urine that is present throughout the entire stream is the most common presentation and can be due to bleeding from any organ of the urinary tract. Apart from the causes mentioned above, infection of the kidneys (pyelonephritis), damage or inflammation of the filtration system (nephrotic or nephritic syndromes), genetic diseases, and cancer are other known causes.
Spots of blood may suggest bleeding from the urethra or prostate, while wormlike clots probably come from the ureters.
Trauma to the abdomen, back, and genital area can cause any pattern of hematuria.

Importantly, not all red urine is because of blood. Some drugs and even foods such as beets and rhubarb can turn urine red. Also, blood that is noticed in the toilet bowl or paper might not be coming from the urogenital tract itself. Some other sources could be the rectum or vagina in women.

It is unlikely to determine the cause of red urine just by looking at it. If you see color changes in your urine, it is best to go to the doctor, as the causes vary widely in severity and the treatment options are different for each case.

Reference:
https://www.niddk.nih.gov/health-information/urologic-diseases/hematuria-blood-urine
https://www.pennmedicine.org/for-patients-and-visitors/patient-information/conditions-treated-a-to-z/hematuria#:~:text=Blood%20in%20your%20urine%20is,in%20the%20water%20after%20urinating.
https://uihc.org/health-topics/hematuria-blood-urine#:~:text=When%20the%20blood%20in%20the,the%20kidneys%20and%20the%20bladder).