Introduction
A Jew is not permitted to benefit from work done for another Jew on Shabbat, but a Jew can benefit from work done for a non-Jew on Shabbat. If a Jew does forbidden work on Shabbat and another Jew wants to benefit from that work, he/she must wait after Shabbat however long it would take for that work to be done. For instance, if I make a roast on Shabbat (Heaven forbid!) and then my wife (who is Jewish) wants to eat it, she must wait after Shabbat however long it would take to make that roast.
Our mishnah deals with a case where we don't know whether the work that was done on Shabbat was done for Jews or non-Jews.
We should note that it doesn't matter who did the work—Jew or non-Jew. What matters is whether the work was done for a Jew or for a non-Jew.
This mishnah begins a series of mishnayot, all of which deal with a city in which there are some Jewish and some non-Jewish inhabitants.
Mishnah Five
1) A city in which Israelites and non-Jews dwell together and there was a bathhouse working on Shabbat:
2) If the majority [of the inhabitants] were non-Jews, one may bathe in it immediately [after the conclusion of the Shabbat];
a) If the majority were Israelites, one must wait until the water can be heated;
b) If they were half and half, one must [also] wait until the water can be heated.
3) Rabbi Judah says: if the bathhouse was small and there was there a [non-Jewish] authority, one may bathe in it immediately [after the conclusion of Shabbat].
Explanation
Section one: In this city there is a bathhouse that operates on Shabbat and the question is whether a Jew can go and bathe there immediately after Shabbat in water that was heated on Shabbat.
Section two: If the majority of the residents of the city were non-Jews, then we can assume the water was heated on behalf of a non-Jew and one can bathe there right after Shabbat.
If the majority were Jews then the water was probably heated for a Jew. In such a situation if the Jew bathed there immediately after Shabbat he would be deriving benefit from work done for a Jew on Shabbat. Therefore, he must wait a sufficient time after Shabbat for the water to have been heated. Then he can take a bath (always nice to take a bath after Shabbat). Again, if the amount of Jews and non-Jews is equivalent, the rule is strict.
Section three: If there was a small bathhouse and there was a non-Jewish, probably Roman, government located there, we can assume the water was heated for them (it's good to be the king, or the king's messengers). In this case a Jew could bathe there immediately after Shabbat, even if the majority of the city were Jews.