What is the role of foreskin?

While intuitively and developmentally foreskin acts as protective sheath over glans penis, there is no evidence that this function is of importance for modern men.  Studies of circumcised compared to non-circumcised men demonstrated that circumcised men actually experience less traumatic events arising from sexual intercourse.

What about nerve endings – does circumcision affect sensation?

Foreskin does contain nerve endings.  Nonetheless, few men notice difference in sensation between circumcised and non-circumsised penis.   In a randomized study of circumcision, fewer than 1-2% of men noticed significant difference in sexual sensation or performance after circumcision.  Most of the differences were minor.