"A Danish study of facemasks, which came out in November 2020, included over 4,000 people. It was a randomised controlled trial. It proved that masks are useless in stopping the spread of COVID-19."
The study only looked at protection of the wearer. The study was limited in that it only tested whether those randomised to the mask-wearing group got infected more than those in the control group. It would have been far more complex to check whether the mask-wearers spread the disease to others (the idea of using masks as "source control"). This wasn't tested at all.
Problems were pointed out before the study appeared. The criticisms of the study aren't post hoc sour-grapes on the part of critics who dislike the study's conclusions. Reasons to be doubtful of the results of the study—including the problem discussed in point (3) below, as well as concerns about whether the study could ensure that the people who were sent boxes of masks would actually wear them—were pointed out before any results of the study were released.
The study was too small. Even though 4,000 people seems like a lot, the study only had the ability (technically, the "statistical power") to detect an effect if wearing surgical masks lowered infection risk to the wearer by 50% or more. To detect smaller effects, it would have to have recruited very many more participants. Since it's plausible that masks have a smaller effect, which would still be helpful in combination with other measures, this study was largely uninformative. It was certainly not conclusive proof—or particularly useful evidence at all—in the debate over masks. Note that the "50% or more" point is not our interpretation, but is noted prominently in the paper by its own authors.
There are other reasons to think masks work. Although randomised controlled trials are the gold standard of evidence, for some interventions it's not realistic to expect that many high-quality ones will be done. There are a number of theoretical reasons to think masks work, as described in a review paper in the Proceedings of the National Academy of Sciences; there are also studies which use "natural experiments" to show that mask-wearing may have reduced COVID spread.
This is also borne out in cross-country analysis: one study found that “each week of the infection in a country without masks was associated with an increase in per-capita mortality of 50.7%... By contrast, for each week that masks were worn, the per-capita mortality was associated with a lesser increase of 12.6% each week." That is, mask-wearing norms were associated, in the model provided in that study, with less accelerated increases in coronavirus spread.
A meta-analysis commissioned by the Royal Society concludes that “use of cotton masks is associated with a 54% lower relative odds of infection in comparison to the no mask groups... For paper masks, the relative odds of infection were 39% lower than in the no mask” (see the linked paper for full statistical details).
Page added on 19 January 2021
Edited 19 January 2021: Changed internal reference to from "point 1" to "point 3" as points had been reorganised.
Edited 24 January 2021: Removed one instance of "mask" from the page title