Ends a proof with a Halmos tombstone—the black square—set flush against the right margin, as $\mathrm{\TeX}$ does at the end of a proof environment. Hovering it says Quod erat demonstrandum—which was to be demonstrated.
...and this completes the proof. {{QED}}
Write it at the end of the last line of the proof, not on a line of its own: the square floats out to the right of whatever line it lands in, and the text goes on running to the left of it.
An extra sentence can be added to the tooltip, after the Latin, for something worth saying about that particular proof:
{{QED|Rather longer than it should be.}}
{{qed}} in lower case works too (Template:Qed redirects here; it used to hold a bare ∎).
The square is a box of CSS rather than the character ∎ (U+220E), which comes out as a thin sliver in some fonts and not at all in others; it carries the class qed, so its size and colour can be overruled from MediaWiki:Common.css.