Some mathematicians study shapes. We call them topologists. Topologists study flat shapes like a circle or a square, which can be drawn on paper. They also study bulgy shapes, like the shape of a ball or a mug, which can be held in our hands and felt.
Some mathematicians study languages. We call them logicians. Logicians want to understand how languages can help us talk about numbers. One of the languages which they study is called 'Modal Language'. Logicians have been using this language to talk about family trees and other stuff, but not what topologists usually study. To a topologist, this language may sound foreign. After studying this language a lot, the logicians have made different collections of sentences and given them different names like K, S4, S5, etc. These collections are made such that if you want to talk about certain things, using the sentences from K is a smart choice; if you eant to talk about other things, maybe using the sentences from S5 is a wise choice.
Many years ago, some people thought hard about the language and found that they could use it to talk about shapes, the things topologists study, as well. And what's even more exciting is that if you want to talk about specific shapes, S4 helps. To explain it better, if you took a sentence from the collection S4 and used it to say something about the shape, everything you would be telling would automatically be true about the shape. So, one way to understand the shape better is to take a sentence from S4 and use it to talk about the shape. In this way, logicians have helped topologists understand shapes better.
But that's not all. These collections of sentences called K, S4, S5, and others are not fully known to the logicians. For example, take S4. The logicians do know some specific sentences that are in S4. They also know how to make new sentences that will be in S4 by combining sentences already known to be in S4. But if you give the logicians a sentence unexpectedly, and ask them if the sentence is in S4, most of the time, it will be very tough for them to answer a 'Yes' or a 'No.' The same happens with K, S5, and others.
Here the topologists come into play. Topologists already know many things about shapes. It turns out that if you tell truth about shapes and somehow can use a sentence from the modal language in doing so, the sentence will be in S4. So to understand S4 better, one can study the shapes. In this way, the topologists have helped the logicians understand the modal language better.