How does an erection occur?

An erection occurs when the male penis is filled with blood. Also the muscles harden in the penis to make it hard with help of muscle linked to the anus. That's why a guy clenches up when he releases semen. Usually this process starts when the male thinks of something or sees or feels something that turns him on (gets him sexually aroused). That then causes the penis to fill up with blood, and harden, therefore creating an erection. Younger males sometimes just have erection 24/7 for no reason at all but apparently puberty.