There were a number of factors that allowed the American colonists to prevail in the Revolutionary War. Let us examine the two most important of these factors.
First, the Americans were able to win because they were more motivated than the British. The British Empire did not have nearly as much at stake as the Americans did. This is similar to what happened with the US in Vietnam almost two centuries later. The US gave up and stopped fighting in Vietnam because the result simply did not matter as much to the Americans as it did to the Vietnamese. The same is true of the Revolutionary War. The British government was willing to, at some point, cut its losses and leave. The colonists were more dedicated and more willing to pay the price needed to win the conflict.
Second, the Americans got help from the outside. Again, this is similar to what happened in Vietnam. In Vietnam, the US had geopolitical rivals who wanted to hurt the US. This led them to help the North Vietnamese. In the Revolutionary War, the British also had geopolitical rivals, most notably the French. The French wanted to weaken the British in any way possible. Because of this, they supported the American colonists with weapons, with money, and even with actual military forces. By doing this, the French made it much more likely that the colonists would be able to win.
These were the two main ways in which the colonists were able to win. They had a lot of help from Britain’s rivals and they cared much more about the outcome of the conflict than the British did.