Surnames ending in -ski are adjectival, and an adjective (as we all remember from school) describes someone as being of, about descended from, connected to or associated with a thing, place or whatever.
Originally knights and nobles had names such as Jan z Tarnowa (John of Tarnów) which in time adjectivalised into Jan Tarnowski.
English experienced a similar, albeit not identical process. John of Bedford eventually became simply John Bedford (the 'of' got dropped).
That is not to suggest that everyone with a Polish surname ending in -ski can trace their roots back to noble lineage, but it does mean there were nobles using that surname. More nobles used -ski ending names than those, for instance, describing tools, foods and animals: Motyka, Byk, Serwatka, Żyto, Kogut, Kołek, Baran, £opata, Wróbel, etc. which were names most often used by peasants. But there were nobles amongst the bearers of such names as well. At times, am entire village got ennobled for defending the prince against an enemy foray.
The German equiavlent of a -ski name is one starting with von, Dutch -- van, French -- de, etc.