Will the meaning of this sentence change if I remove "to" in the second sentence?
He wanted to go to the park by himself. But I didn't allow him to.
Will the meaning of this sentence change if I remove "to" in the second sentence?
He wanted to go to the park by himself. But I didn't allow him to.
Here is the rule on avoiding repetition:
or repetition avoidance and To:
We use auxiliary verbs to avoid repeating the same verb or verb phrase in a sentence.
If the first part contains an auxiliary verb, we use the same verb in the second part.
I don’t like going to spas, but my wife does. [instead of: my wife likes going to spas]
I thought I had lost my keys, but I hadn’t. [instead of repeating: but I hadn't lost my keys]
Tom can play the guitar and Tina can’t. [same idea] [...]
You do not need to repeat: to go to the park himself. Often, the un-repeated phrase is in the same sentence:
Yes, the to is always necessary in a case of repetition avoidance. What isn't necessary is to repeat the phrase: go to the park by himself.
Certain verbs like want, like, hate, have (as in "have/have got to do something), love, consider, seem, appear often use the to function word:
MARY: He wants to go sailing but I don't. OR: I don't want to.
JOHN: You seem to want to. Right?
MARY: Yes, I know it can seem like I want to.
The point here is that in speaking, we avoid repeating the phrase: go sailing.
This is type of usage is very,very common in English and can be daunting to learners. There is an entire world of auxiliaries and non-repetition used all the time in English.
"But I didn't allow him" is not a complete sentence in the way that "But I didn't allow him to" is, and I can't believe that two comments on your question have suggested that it would be acceptable. Maybe strictly there is no change in meaning between the two, but where there is a change is in that one of them (-- with the 'to') sounds like a perfectly natural example of English, and the other sounds to my ear almost like a stereotypical mistake that a non-native speaker might make.
The natural way to phrase it without ending your sentence with 'to' would be:
"He wanted to go to the park by himself. But I didn't let him".
Saying or writing "I didn't allow him to." is poor grammar and the answers and comments saying that it's ok are enough to make one cringe.
Saying "I didn't allow him" is correct because it is saying "I didn't allow him [to go to the park by himself]", as well as not ending a sentence with a preposition.
Using "I didn't let him" or "I didn't allow it" are more common formulations, as well as being correct and conveying the same message.
Strictly speaking, "I didn't allow him" lacks a connective topical element, hence making the topical focus fully on the presented subject point [ie, him]. In short, you'd be stating that you're not allowing that individual's existence.
While we're not likely to interpret you as having randomly refused someone's existence by your own say-so (unless you're a particular sort of politician), another context may be a bit less intuitive in regards to avoiding any confusion.
This is essentially the entire purpose of prepositions and indefinite articles in the first place. Such terms can commonly be removed from any location within a sentence without too much effect on the resulting interpretation, but they're nevertheless highly valuable in both helping with sentence flow and in assisting in ensuring that no miscommunication occurs in those contexts where interpretation is a bit less intuitive.
To put that more simply, a preposition [such as "to"] can be just as effective at fulfilling its role at the end of a sentence as it is in the middle of one. Trailing prepositions may seem unusual, but they're fundamentally no different in purpose than a preposition located elsewhere.
As far as the benefit of a trailing "to" and the confusion caused by its removal, note that the trailing "to" serves the purpose of avoiding the needless repetition of topical information, while still connecting two sentence structures to the same topic.
For example, within "He wanted to go to the park by himself. But I didn't allow him to" the "to" serves the purpose of removing the italicized portion of "He wanted to go to the park by himself. But I didn't allow him to go to the park by himself". Moreover, the usage of "to" as such a shorthand for reassociating a new statement to a preceeding topic is well understood, meaning that anyone familiar enough with English would make the connection naturally. [Contributor Lambie offers a further example of such usage in another comment.]
By contrast, if you remove the "to" and don't replace it with a similar element, then you completely lose out on making a clear reference to a preceeding topic. While you may expect someone to still be able to interpret it, the choice of language in that circumstance wouldn't inherently invite such a comprehension (and thus, the responsibility for any misinterpretation of such an element would fall entirely on the speaker).
Rather, at that point, you'd be compelled to combine the sentences [via a comma and appropriate rephrasing to suit], as the context is no longer presented in a manner that would properly connect a topic suitably between two seperate sentences.
Alternatively, simply use a semicolon between the sentences, as semicolons inherently relate the sentences they connect to one another. The second sentence may perhaps still feel a bit off [without the somewhat expected "to"], but there'd be no confusion over what topic the sentence is being associated with.
In summation, the "to" following such a sentence is serving the same function as a comma or semicolon preceding it. If your intent is proper clarity in the presentation of topical associations, then you've either got to have one or the other, or rework the second sentence to be more detailed.
No, it’s not always necessary. Here’s why: first of all, your example should be one sentence, not two—there should be a comma between 'himself' and 'but'.
Now the sentence reads:
“He wanted to go to the park by himself, but I didn’t allow him to.”
If you’ll notice, the second part of the sentence is not a complete thought—“I didn’t allow him to” what? That makes it also an incomplete sentence, but it’s okay—as long as you’re using the sentence in a casual way, as apposed to, say, writing a formal letter—because one can still understand what you’re trying to express.
Now then, if you had written:
“He wanted to go to the park by himself, but I wouldn’t allow him.”
People would still understand exactly what you meant. So, in a case where you’ve written an incomplete sentence in the first place, yet people can still understand what you wish to express, it doesn’t really matter where you end the sentence—in this case, you can leave off the final “to” because, again, people will still understand what you mean.