Let R be an associative ring. Given a positive integer n≥2, for a1,…,an∈R we define [a1,…,an]n:=a1a2⋯an−anan−1⋯a1, the n-generalized commutator of a1,…,an. By an n-generalized Lie ideal of R (at the (r+1)th position with r≥0) we mean an additive subgroup A of R satisfying [x1,…,xr,a,y1,…,ys]n∈A for all xi,yj∈R and all a∈A, where r+s=n−1. In the paper, we study n-generalized commutators of rings and prove that if R is a noncommutative prime ring and n≥3, then every nonzero n-generalized Lie ideal of R contains a nonzero ideal. Therefore, if R is a noncommutative simple ring, then R=[R,…,R]n. This extends a classical result due to Herstein [Generalized commutators in rings, Portugal. Math. 13 (1954) 137–139]. Some generalizations and related questions on n-generalized commutators and their relationship with noncommutative polynomials are also discussed.