When reading Dostoyevski's books I often find characters that use a manner of speech that adds "-с" and the end of the words. What does it mean? Is it used to convey some emotion or is it characteristic of some social class dialect?
It's a so-called
словоерс, from слово and ер (names of the constituting letters
ъ) — a contraction of сударь.
Used to express self-effacement, servility or respect (as when adding sir to each sentence in English).
Currently it may be used in jocular manner to imitate old speech.
Неожиданный словоерс пронзил Наташину память с детства знакомой ― угодливой и втайне презирающей ― интонацией: галантерейного приказчика, официанта, гостиничного лакея… [Сергей Бабаян. Господа офицеры (1994)]
Скорее бы надо сказать: штабс-капитан Словоерсов, а не Снегирев, ибо лишь со второй половины жизни стал говорить словоерсами. Словоерс приобретается в унижении. [Ф. М. Достоевский. Братья Карамазовы (1880)]
A little of history in addition to the answer by Quassnoi. Indeed the ending -с is the severely reduced сударь ('sir'), which is in turn sometimes considered to be a contraction from государь (somewhat similar to 'my lord' in English). Being a trailing consonant in words, it was spelled as -съ in old Russian.
In the church-Slavonic language, each letter had its own name. For example, the first two letters of the alphabet, а and б were called аз and буки and gave the name to Russian alphabet—азбука. Similarly, letters cъ were called слово and ер, therefore this ending got the popular name словоерс [slɑvəˈjers].
The spelling reform of 1917 (which is often connected to the socialistic revolution but was actually prepared by Shakhmatov much earlier) has removed the trailing ъ, and therefore in the modern typography old texts are printed with just -с at the end.
This ending was supposed to emphasize respect to the addressee. The revolution of 1917 "made everyone equal", and the use of this ending was therefore discouraged. However many older people, especially from the higher society level (professors, doctors), continued using it—as a sort of a quiet protest against the changes, which made them equal to common people. This can be seen in many Soviet films.