What's the purpose of 上 in "王教授给那儿的学生上英国文学课, 他课上得非常好"?
So I checked Cihai and it specifically says 上課 goes both ways:

教師講課或學生聽課 
To teach a class, or to attend a class

The subject is 'Professor Wang' (王教授). The verb is 'to teach' (上, note: only makes sense when seeing 上課 together), the direct object is 'a lesson' (課), and the indirect object is 'those students' (那兒的學生), which in Chinese is marked by a second verb literally meaning 'to give' (給).
The second 上 still means 'to teach', with the direct object understood and omitted.