Q. How come it is forbidden to work on Shabbat, but then Rabbis get paid to conduct Shabbat Services?
A. Only the thirty nine labours and their derivatives, including rabbinical injunctions, are prohibited on Shabbath. Teaching Torah, conducting liturgical services, answering faith related questions and performing mitzvos are all tasks that are not only permitted but also encouraged to be done specially on Shabbath.
You are right in that there is a rabbinical ban on being remunerated for any work done on Shabbath or Yom Tov. However, the prohibition applies only when one is paid for the work done only on those days. When one is compensated for work also done in weekdays together (Behavlaa) with Shabbath and Yom Tov, it is permitted. ( Shulchan Aruch O.H. 306: 4, 246: 1, 243: 1)
Rabbi A. Bartfeld as revised by Horav Shlomo Miller Shlit”a