"Shema Yisrael…Echad / Listen, Israel, G‑d is our G‑d, G‑d is one." (Prayerbook, from Deut. 6:4)

Rabbi Ze'ira said, "Whoever repeats the Shema Yisrael [verse more than once when praying] should be silenced."

"Whoever repeats the Shema Yisrael...should be silenced."

Rabbi Papa asked Abayee, "Perhaps this person simply did not concentrate well the first time, and the second time he is able to concentrate."

"Does G‑d have any friends in heaven? If he is unable to concentrate the first time," he answered him, "He is struck with a sledgehammer until he is able to concentrate." (Berachot 33a-34b)

The Baal Shem Tov taught:
The question still remains. Perhaps this person wants to repeat the verse because he was unable to concentrate the first time, and now he wants to fulfill his obligation and recite it with concentration. Furthermore, why does Rabbi Ze'ira only speak about someone who repeated the Shema Yisrael, and not about any other verse in the Shema prayer, or any other verse, for that matter?

This can be understood by comprehending what it means to accept the yoke of heaven. A person should believe that G‑d's glory fills all worlds, and that there is nothing in which He does not exist. Thus, G‑d's existence is inherent in all of man's thoughts, and each and every human thought is a complete spiritual structure on its own. Hence, when an untoward thought arises in one's mind during prayer, it arises so that he rectifies it and raises it back to its Source. If one does not believe this, then one has not fully accepted the yoke of heaven, for he is placing a limit on G‑d's existence.

Thus, the person who repeated the Shema prayer because he had an untoward thought the first time. But had he known that even in that untoward thought he could have found G‑d, he would not have had to repeat the verse. And this is what the Talmud alludes to by being struck with a sledgehammer:1 The thoughts themselves are striking the person like a sledgehammer so that he rectify them and elevate them, so why should he repeat the Shema, which would imply that G‑d could not be found in his first recitation. By doing so, he places a limit on G‑d's existence, and in the acceptance of the yoke of heaven, which is why he must be silenced.2
...even in that untoward thought he could have found G‑d...
However, sometimes there are thoughts that one must push aside. The question is, then, how is one to know which to push aside and which to elevate? The answer to that is that one should take note if when the untoward thought arises in one's mind, if a corresponding thought of how to rectify and elevate it arises simultaneously in one's mind, then one should work with that thought to elevate it. However, if the thought of rectifying and elevating the untoward thought does not arise in one's mind, then the untoward thought was probably sent to him simply to confuse him and distract him from his prayers. In that case, one may push the thought aside, following the rule, "If someone is pursuing you to kill you, you may kill him first." (Talmud Berachot 58a)

In conclusion, if one has recited several words of the Shema or other prayers without proper concentration, one should not repeat those words orally, but one may think those words in his mind.3

[Translation and commentary from Keter Shem Tov (#39) by Rabbi Yehoshua Starrett. First published on //baalshemtov.com. Reprinted with permission.]