Why do men lose erections after they ejaculate?
From a reproductive standpoint, the purpose of an erection is to allow for penetration and ejaculation. Once the erection has served that purpose, there is no reason for it to continue. Also, typically after ejaculation or orgasm, sexual arousal wans. As that arousal goes down, so does an erection. The same sort of thing happens in women as well. During sexual activity, the body and genitals are aroused. This includes extra blood rushing to the genital region, swelling in that area, relaxation and lubrication of the vaginal canal, etc. Once sexual activity ends, those signs of arousal will subside. If desired, after a "refractory period", arousal can generally be achieved again. (You also may want to keep in mind that there are many types of sexual activity that do not require an erection. So just because an erection ends, that does not mean sexual activity is automatically over if you don't want it to be as well.)
It is also important to remember that it is also necessary for arousal to go down after sexual activity is over. During an erection, the blood vessels of the penis constrict to allow the erection to occur. If that constriction continues for too long, the cells can actually be damaged. This condition is called priapism (find out more about the condition and it's treatment at this page on WebMD) and can cause permanent damage and be very painful. This condition is not something that happens on a regular basis (it's most often associated with things like sickle-cell disease, leukemia, malaria or medications used to treat erectile dysfunction) because the body is designed to know when it's time to relax, but it does happen for some people.
You might want to check out the following links: