When a string breaks on a piano, it often breaks at or very near the tuning pin. This means the majority of the string’s length is still perfectly viable, and in fact is ideally suited to the rest of the piano in age, timbre, and general wear. In these cases, it’s often best to splice the string (tie a knot, essentially), creating a new lead wire to attach to the tuning pin, but leaving the rest of the string’s length almost exactly as it was before.
This is especially preferable on bass strings, where the length of the string and the thickness of the copper winding is completely customized, meaning a replacement string must be a custom order, and even still will not match the old strings very well in timbre and appearance.
The picture is of a recent splice on a customer’s old spinet piano. The piano is not worth the investment of new strings, and even a single custom-order replacement is expensive and time-consuming, so this was a far better option. The string is practically as good as new, sounds identical to its neighbors, will hold its tune better than a new string, and should last for many more years.
Occasionally, strings break in odd places which make a splice impractical or impossible. But more often than not, a splice is the way to go. So if you ever break a string in your piano, don’t throw it away!