"He who does many forbidden melakhot which are like one melakhah is liable only for one [sacrifice]."
Note: This passage was first taught to me by Rabbi Joel Roth, whose explanation I use below.
One who performs any of the forbidden labors on Shabbat is held criminally liable. If one, however, does so inadvertently (either because one forgot that it was Shabbat, or because one did not know that the act was forbidden), the Torah requires a sacrifice for each violation.
Now, let us suppose that Reuven, having completely forgotten that it was Shabbat, went out to work in his yard. In the course of the three uninterrupted hours he spent there, he reseeded a bald spot on the lawn, pruned back the hedges, and planted an evergreen sapling. After finishing all of this work, he suddenly remembered that it was Shabbat.
Reuven has performed three forbidden labors, all in one uninterrupted period of "forgetfulness" that it was Shabbat. Obviously, his violation of Shabbat was completely inadvertent. Were the Temple standing in Jerusalem, he would be liable to bring a sacrifice. But, how many would he have to bring? One for each of the forbidden activities that he did? If so, in this case he would have to bring three.
The Talmud teaches us that if one performs even many forbidden activities, he is liable for only one expiatory sacrifice, if all of the activities were of similar purpose, as in our case above. Thus, Reuven would be liable for only one sacrifice. If, during those same three hours, Reuven had also rehung the door that had fallen off of his tool shed, he would have been liable for two sacrifices. Fixing a broken door, though absolutely forbidden on Shabbat, is not an activity with the same purpose as the other things he had done. Note that when we use the word purpose, we are really referring to the conceptual categories as defined by the Avot Melakhah (the forbidden labors listed in Mishnah Shabbat 7:2). Therefore, if during those same three hours, he had also gone on to paint the door, he would be responsible for yet a third expiatory sacrifice, for though we might argue that painting the door has a similar "purpose" to hanging it, painting is a different conceptual category from building.