The Sages enacted the prohibition of "Amira Le’nochri" which forbids asking a gentile to perform an activity on Shabbat that is forbidden for a Jew to perform. However, they made an exception to this rule in cases of "Pesik Resheh," meaning, permissible activities that will invariably result in a forbidden act. For example, if a person forgot to disable the refrigerator light before Shabbat, it is certainly forbidden for a Jew to open the refrigerator door on Shabbat. Even though he has no intention to turn on the light, but rather to open the door to gain access to the contents of the refrigerator, he may not open the door since this will inevitably cause the light to turn on. It is permissible, however, to ask one’s non-Jewish housekeeper to open the refrigerator door in this case. Since the Sages did not apply to "Amira Le’nochri" prohibition to cases of "Pesik Resheh," one may ask a gentile to perform such an act. The housekeeper in this case intends simply to open the door, and not to turn on the light, and it is therefore permissible for a Jew to ask her to open the door on Shabbat.
This would also apply to a case where somebody forgot something in his car before Shabbat. For example, if on Shabbat a man realizes that he left his Tallit in the car, he may ask a gentile to retrieve it from the car. Even though it is certainly forbidden for a Jew to open the car door on Shabbat, as this would cause the lights to turn on, one may ask a gentile to bring something from the car. It should be noted, however, that this applies only to items which one needs for Shabbat, such as a Tallit or fruit which one wishes to serve for dessert. One may not ask a non-Jew to bring in something from the car that he does not need until after Shabbat, such as clothing which he wishes to wear to a function on Mosa’eh Shabbat.
By the same token, one may instruct the non-Jewish housekeeper to wash dishes with hot water on Shabbat. A Jew may not use hot water on Shabbat, since turning on the hot water causes cold water to enter the hot water tank and be heated. The person has no intention to heat water in the tank when he turns on the hot water, but it is nevertheless forbidden because this action will inevitably result in the heating of cold water. But since such situations are not included in the prohibition of "Amira Le’nochri," one may instruct a non-Jewish housekeeper to use hot water when this is needed on Shabbat. Likewise, if one wants to wash his hands with warm water on Shabbat, he may ask the gentile housekeeper to bring him hot water from the tap, for the same reason. (This does not mean that one may ask a non-Jewish housekeeper to turn on the shower for him and then shower on Shabbat. Bathing with hot water on Shabbat is forbidden irrespective of the prohibition against turning on the hot water.)
Another application of this rule involves hanging a wet garment near steam or a heater. If a person’s jacket became wet in the rain, for example, he may not hang it near a source of heat, either because the water droplets absorbed in the garment will be heated, or because this constitutes "Melaben" ("laundering") the garment. However, since the hanging is not done for the purpose of heating the droplets or cleaning the garment, one may ask a non-Jew to hang the garment for him near a heat source. Since this is a situation of "Pesik Resheh," where the Melacha (forbidden action) is unintended, one may ask a gentile to perform this action for him on Shabbat.
Summary: Although one may not ask a gentile to perform on Shabbat an activity forbidden for Jews, one may ask a gentile to perform on Shabbat a permissible activity that will yield a forbidden result. Thus, for example, one may ask a non-Jew to open a refrigerator door or car door on Shabbat (if this is necessary for the purposes of Shabbat) even though the light will turn on. One may also instruct a non-Jew to turn on the hot water in the tap, even though this will cause cold water to enter the water tank and be heated.