The Mishna says that if a goy does melacha for himself, a Jew can benefit from it, but if done for the Jew, it depends. If it is a melacha d'oraysa then no Jew can benefit from it, but if it is only a melacha d'rabonon then the one who it was done for cannot benefit from it (Tosafos says this to answer the question of techum which is only assur for the one it was done for. The Ran says that perhaps techum is a special leniency since it is different for each person, but a standard issur d'rabonon done for a Jew would be assur for everyone).
The gemara develops the details of the rules as to when a Jew could benefit from the melacha of a goy. Anytime a goy does a melacha for a Jew it is assur because we are afraid that if we allow the Jew to benefit, he will come to tell the goy to do it (Tosafos). If he does it for himself, then it depends. A type of melacha that you would increase the quantity based on the number of people that need to benefit is assur because we are afraid he is going to do extra for the Jew. But if it is like a candle or ramp to exit a boat where it is the same melacha no matter how many it is done for, even if he knows the Jew, since he is doing it also for himself, it is permitted. It is also clear from the gemara that when a goy is lighting a candle for himself, even if there are many Jews who would be benefiting, it is permitted since we consider the primary melacha to be for himself. But if he is doing it for others, we follow the majority and assume he is doing it for whoever the majority is (mostly jews would be assur, and half jews would be a safeik issur).
There is a stark contrast between the previous Mishna 121a and this Mishna 122a. In the earlier Mishna it permits the Jew to allow the goy to extinguish a fire for the Jew, yet in this Mishna it forbids allowing the goy to light a fire for the Jew. Tosafos asks what is the rationale behind this distinction? Furthermore, why does the Mishna change from the melacha of extinguishing to the melacha of ligthing?
Tosafos (d.h. v'im) explains that when the Jew is going to be benefiting from the melacha of a goy, we don't consider the goy to be doing it for himself unless the goy is actually doing it for himself (or another goy). Therefore, the latter Mishna doesn't permit benefiting from the candle unless the goy lit it for himself (or for himself and others). But when the Jew is not actually deriving benefit from the melacha done by the goy, even if the goy is doing the melacha for the Jew, we consider him to be doing it for himself since he knows that he will ultimately benefit from the good will created. In short, a Jew can allow a goy to do a melacha for the Jew when there is no direct benefit that the Jew derives from the melacha. The extinguishing of a fire or candle is not considered a direct benefit that the Jew derives from the melacha (the fact that his house didn't burn down, or that it is now dark so he can sleep is considered an indirect benefit). This is a very important distinction to explain why it would be permitted to allow a non-jew to shut off the lights in a room so that you can sleep, but if he would turn on the lights it would be forbidden to read (or do any activity that couldn't be done in the dark) in that room.
Another interesting question is raised by Tosafos (d.h. mishtameish). Tosafos points out that at the beginning of maseches beitzah we find that chazal made a gezeira on fruits that fall of trees or liquid that flow out of fruits that it is forbidden to eat them because we are afraid that if we permit it, one will come to pick the fruits and squeeze fruits on shabbos and yom tov. Why here aren't we concerned that if we permit a Jew to benefit from the light of a candle when the goy lit it for himself, one will come to light candles on shabbos? Tosafos answers that chazal were only gozer on melachos that are easy to do and one is is drawn to do them such as food related things, but things that are either not so easy to do or one is not so motivated to do, there is no gezeira. The Ran in the name of the Ramban answers this question differently. He says that things that occur by themselves are somewhat common and therefore a problem, but since Jews usually live in sectioned off areas and not among goyim, it isn't common to have a goy do melacha for a jew so we don't impose a gezeira. Based on this distinction of the Ramban, it is very possible that nowadays since we live among non-jews, it would be forbidden to use a light that a non-jew lit for himself because it is common so that we are concerned the Jew will come to light the candle himself.
Another interesting question is raised by Tosafos (d.h. mishtameish). Tosafos points out that at the beginning of maseches beitzah we find that chazal made a gezeira on fruits that fall of trees or liquid that flow out of fruits that it is forbidden to eat them because we are afraid that if we permit it, one will come to pick the fruits and squeeze fruits on shabbos and yom tov. Why here aren't we concerned that if we permit a Jew to benefit from the light of a candle when the goy lit it for himself, one will come to light candles on shabbos? Tosafos answers that chazal were only gozer on melachos that are easy to do and one is is drawn to do them such as food related things, but things that are either not so easy to do or one is not so motivated to do, there is no gezeira. The Ran in the name of the Ramban answers this question differently. He says that things that occur by themselves are somewhat common and therefore a problem, but since Jews usually live in sectioned off areas and not among goyim, it isn't common to have a goy do melacha for a jew so we don't impose a gezeira. Based on this distinction of the Ramban, it is very possible that nowadays since we live among non-jews, it would be forbidden to use a light that a non-jew lit for himself because it is common so that we are concerned the Jew will come to light the candle himself.