What with the collapse of the Austro-Hungarian, Russian, German, and Ottoman empires, and the general anti-monarchist views that arose post-WWI, how did the British manage to retain a monarchy? Was it just because they won? And even then, weren't they economically weak?
They did not have power. They lost their power long before the other monarchs, in the case of some, before their nations were even formed. The reason the British monarchy remained whilst so many others toppled was for one simple reason: The German Empire, the Austro-Hungarian Empire, the Russian Empire were all autocratic states. The United Kingdom was not.
The United Kingdom has benefited from not being tied down to a single document that defines the role of the State and its functions to the point where it's actually difficult to pinpoint when a successor state emerges from the previous.
As an example, look at Germany. The nation was clearly founded in 1871. Then a new nation was founded in 1919 to serve as a successor, then in 1945 another. Also, for the purpose of my explanation, the "nation" is referring to the expansion in the frontiers of sovereignty, as such the UK has an absence of this tradition of single documents and this has allowed evolutionary, rather than revolutionary growth, arguably over a period of well over 1, 000 years.
During the time of the Heptarchy in England, there was a meeting of Wise Men, or Witenagemot which began at least during the 6th century, that would convene to represent their kingdoms and advise the king(s) on how matters should be pursued in the benefit of the king, the people and the nation. This would be the base for national representative government and the tradition of no document defining their role.
Following the Norman succession to the throne of England this meeting would still convene, but renamed as the Curia Regis, or King's Council. The job remained the same, advising the king on matters of taxation, security, both internal and external. The function is still mainly advisory, but the feudal system of England meant the king needed his advisers more than the advisers needed the king. The Council would eventually evolve specialist institutions, which we now have as departments in government.
By 1215 this would evolve into the first English parliament, composed of the Lords of England. Obviously, they resulted in the creation of the Magna Carta, the first real constraint on the power of the monarch that was not just de facto, but also de jure. He had to consult the parliament in matters of taxation, and many others, it's a long document, in 1265 the parliament was expanded to not just have the Lords as representatives of territories, but commoners too (resulting in the current House of Lords, and House of Commons) The Magna Carta would remain as the precedence to all those who wanted to challenge the power of the crown, lasting well into the 17th Century.
In 1603, James VI of Scotland became James I of England and Ireland. Scotland had less of a parliamentary system which caused friction between the Crown and Parliament. His son, Charles I, was also a huge supporter of the idea of the "Divine Right of Kings". That the king represented God, and God is infallible, therefore the king is infallible. This cause Charles to repeatedly disband parliament and govern without consent. This resulted in a civil war, his trial, and execution for treason, and briefly republican government in England.*
*I know I said England didn't have any real revolutionary periods, the official stance is that the republican government effectively "didn't happen". Official documentation was Charles II succeeded the throne immediately after his father's death. Not after the Protectorate.
The execution of Charles I for treason though established that the king cannot govern without consent. So when James II, a Catholic king in an Anglican state, began to relax religious laws in the Isles, this caused friction between the Crown and Parliament, as they tried to advise him, he would hold them in prison. The parliament were willing to put up with James until he died and his protestant daughter would succeed the throne. But then James had a son who would be raised Catholic, and raise Catholic progeny himself, and this was unacceptable to the parliament. Parliament then invited a more compliant relative, William of Orange, to succeed the throne.
This resulted in the Bill of Rights which codified the limitations of the king, and the doctrine of parliamentary sovereignty.
Now the king did still have a power. Parliament is composed of elected commoners, and appointed lords. Lords are appointed by the king, and the king could load the Lords with his supporters, and given the supremacy of the Lords, he could govern, in theory, through them. The Parliament Act in 1911 limited what the Lords could do. They can no longer veto laws, only delay them, and the Salisbury Convention dictates the Lords cannot veto any law that was in the manifesto of the elected government.
By 1911, the UK was, at the time, one of the most democratic nations on the planet.
Like many aspects of the British constitution, the monarchy has powers in theory which don't exist in real life. During period after 1918, the crown gave way to the elected government in every important area. To give two examples, the King appointed Ramsey MacDonald Prime Minister of the first Labour government, and the King abdicated in 1936 at the demand of the government. Elizabeth II has been even more compliant and has limited herself to backroom discussions.
The other reason is that Republicanism never became a core policy of the left in Britain. In fact, the monarchy was a convenient way for Labour to deal with the establishment as well as a reflection of popular patriotism.
Britain is not very unusual in this. Belgium, the Netherlands, Luxembourg, Sweden, Denmark and Norway are all constitutional monarchies. For people (like myself) who come from a Republic, it can seem strange but there is a good pragmatic reason: a government would have to use huge political capital and parliamentary time to change the constitution (including rewriting thousands of existing laws) to create a Republic that has no urgent popular support, decide what to do with the Royals, and deal with a President, possibly from a different party, who will want to do a lot more than the current Queen does. It is not a very appealing prospect.