The technical term is 'vasocongestion.' In simple terms, here's what happens. When a man is aroused, fluids and blood rushes to the penis. The muscles that allow fluids to flow out constrict, and the fluids pool inside. Apparently these things happen to keep blood pressure high enough to maintain an erection. And according to this website, and something I didn't know, the testicles grow 25-50% bigger during erections!!
During orgasm, all the muscles relax and obviously, there is a release. But if there is no release, the fluids and blood continue to pool, and this can cause pain. The blood looses oxygen, which can give it a blue-ish color.
All that happens is some pain and tenderness in the lower stomach/genital area. It can easily be remedied--with ejaculation. And if, for some reason, that doesn't happen, the pain will go away in about an hour anyways.
Sometimes people have fetishes that include orgasm denial. In order to avoid an onset of 'blue balls' during such an act, massaging the genitals slightly can prevent a large pooling of fluids.
Wai Loon, Kris Lee. "Dealing with 'Blue Balls'." Men's Health Suite 101 14 Sept. 2008: n. pag. Web. 18 Jul 2011.