One who knows that it is the Sabbath and performs many labors, and so forth. From where do we derive this? Shmuel said: the verse states, "those who profane it shall surely be put to death" (Exodus 31:14); the Torah multiplied many deaths for a single act of profanation. But this verse is written concerning the deliberate offender. If it is not needed for the matter of the deliberate offender, since it is written, "everyone who does work in it shall be put to death," apply it to the matter of the inadvertent offender; and what does "shall be put to death" mean here? Put to death by monetary payment. But let him derive the division of labors from where Rabbi Natan derives it, for it was taught: Rabbi Natan says, "You shall kindle no fire" (Exodus 35:3); what does the verse teach? Because it says, "And Moses assembled," "six days work shall be done" (Exodus 35:2). The words "words," "the words," "these are the words" indicate the thirty-nine labors that were told to Moses at Sinai. One might think that if a person performed all of them in a single lapse of awareness, he is liable for only one sin-offering; therefore the verse teaches, "in plowing and in harvest you shall rest" (Exodus 34:21). And still I might say he is liable two for plowing and harvesting, but for all of them liable only once; therefore the verse teaches, "you shall kindle no fire." Kindling was included in the general category, and why was it singled out? To draw an analogy and tell you: just as kindling is distinctive in that it is a primary labor and one is liable for it on its own, so too every act that is a primary labor renders one liable on its own. Shmuel holds the view of Rabbi Yose, who said that kindling was singled out to teach a mere prohibition. But let him derive the division of labors from where Rabbi Yose derives it, for it was taught: Rabbi Yose says, "and he does from one of these" (Leviticus 4:2): he does "one" and he does "these." At times one is liable once for all of them, and at times one is liable for each and every one. And Rabbi Yose son of Rabbi Hanina said: what is the reasoning of Rabbi Yose? "One," "from one," "these," "from these." That which is "these" may be "one," and that which is "one" may be "these." "One" is like Shimon [a complete name]; "from one" is part of a name, like Shem from Shimon. "These" are the primary labors; "from these" are the derivative labors. "One" that is "these" refers to deliberate violation of the Sabbath with inadvertent performance of the labors; "these" that are "one" refers to inadvertent violation of the Sabbath with deliberate performance of the labors. As for Shmuel, the reading "one that is these, these that are one" does not carry implication for him.
How the Sages Counted the Thirty-Nine Forbidden Labors of Shabbat
Yalkut Shimoni on Torah 391:2
הַיּוֹדֵעַ שֶׁהוּא שַׁבָּת וְעָשָׂה מְלָאכוֹת וְכוּ'. מִנָּא לָן. אֲמַר שְׁמוּאֵל. אֲמַר קְרָא מְחַלֲלֶיהָ מוֹת יוּמָת, הַתּוֹרָה רִבְּתָה מִיתוֹת הַרְבֵּה עַל חִלּוּל אֶחָד. הַאי בְּמֵזִיד כְּתִיב. אִם אֵינוֹ עִנְיָן לְמֵזִיד דִּכְתִיב "כָּל הָעֹשֶׂה בוֹ מְלָאכָה יוּמָת", תְּנֵהוּ לְעִנְיַן שׁוֹגֵג, וּמַאי יוּמָת, יוּמָת בְּמָמוֹן. וְתֵיפוּק לֵיהּ חִלּוּק מְלָאכוֹת מֵהֵיכָא דְנָפְקָא לְרַבִּי נָתָן, דְּתַנְיָא, רַבִּי נָתָן אוֹמֵר, (שמות לה, ג) "לֹא תְבַעֲרוּ אֵשׁ" מַה תַּלְמוּד לוֹמַר, לְפִי שֶׁנֶּאֱמַר "וַיַּקְהֵל מֹשֶׁה" (שם, ב) "שֵׁשֶׁת יָמִים תֵּעָשֶׂה מְלָאכָה" "דְּבָרִים" "הַדְּבָרִים" "אֵלֶּה הַדְּבָרִים" אֵלּוּ שְׁלֹשִׁים וְתִשְׁעָה מְלָאכוֹת שֶׁנֶּאֱמַר לוֹ לְמֹשֶׁה בְּסִינַי יָכוֹל עֲשָׂאָן כֻּלָּן בְּהֶעֱלֵם אֶחָד אֵינוֹ חַיָּב אֶלָּא חַטָּאת אַחַת, תַּלְמוּד לוֹמַר (שמות לד, כא) "בֶּחָרִישׁ וּבַקָּצִיר תִּשְׁבֹּת", וַעֲדַיִן אֲנִי אוֹמֵר עַל חֲרִישָׁה וּקְצִירָה חַיָּב שְׁתַּיִם עַל כֻּלָּן לֹא יְהֵא חַיָּב אֶלָּא אַחַת, תַּלְמוּד לוֹמַר "לֹא תְבַעֲרוּ" הַבְעָרָה בַּכְּלָל הָיְתָה וְלָמָּה יָצְאָה לְהַקִּישׁ אֵלֶיהָ וְלוֹמַר לְךָ מַה הַבְעָרָה מְיֻחֶדֶת שֶׁהִיא אַב מְלָאכָה וְחַיָּבִין עָלֶיהָ בִּפְנֵי עַצְמָהּ אַף כָּל שֶׁהוּא אַב מְלָאכָה חַיָּבִין עָלֶיהָ בִּפְנֵי עַצְמָהּ. שְׁמוּאֵל סְבַר לָהּ כְּרַבִּי יוֹסֵי דַּאֲמַר הַבְעָרָה לְלָאו יָצְתָה. וְתֵיפוּק לֵיהּ חִלּוּק מְלָאכוֹת מֵהֵיכָא דְּנָפְקָא לֵיהּ לְרַבִּי יוֹסֵי, דְּתַנְיָא, רַבִּי יוֹסִי אוֹמֵר "וְעָשָׂה מֵאַחַת מֵהֵנָּה", עָשָׂה "אַחַת" וְעָשָׂה "הֵנָּה" פְּעָמִים שֶׁחַיָּב אַחַת עַל כֻּלָּן פְּעָמִים שֶׁחַיָּב עַל כָּל אַחַת וְאַחַת, וְאָמַר רַבִּ[י] יוֹסֵי בְּרַבִּי חֲנִינָא מַאי טַעְמָא דְּרַבִּי יוֹסֵי, "אַחַת" "מֵאַחַת" "הֵנָּה" "מֵהֵנָּה", שֶׁהִיא "הֵנָּה" "הֵנָּה" שֶׁהִיא "אַחַת", "אַחַת" שִׁמְעוֹן, "מֵאַחַת" שֵׁם מִשִּׁמְעוֹן, "הֵנָּה אָבוֹת", "מֵהֵנָּה" תּוֹלָדוֹת, "אַחַת" שֶׁהִיא "הֵנָּה" זְדוֹן שַׁבָּת וְשִׁגְגַת מְלָאכוֹת, "הֵנָּה" שֶׁהִיא "אַחַת" שִׁגְגַת שַׁבָּת וּזְדוֹן מְלָאכוֹת. וּשְׁמוּאֵל, "אַחַת" שֶׁהִיא "הֵנָּה" "הֵנָּה" שֶׁהִיא "אַחַת" לָא מַשְׁמָע לֵיהּ.