schablon

s vs. ss vs. ß: Deutsche Rechtschreibung und Aussprache / German spelling and pronunciation

(For help with the IPA pronunciation spelling: https://en.wikipedia.org/wiki/Help:IPA_for_English, https://en.wikipedia.org/wiki/Help:IPA_for_German)

In German, the consonants/consonant pairs s, ss and ß all (usually or always) produce the /s/ sound (they’re known as the S-Laute), but they have differing functions with regard to the pronunciation.

S

Beginning a word: If the S is at the beginning of a word followed by a vowel, it is always pronounced /z/ apart from names and possibly loan words from other languages.
Examples: sein /zaɪn/, satt /zat/, sollen /ˈzɔlən/, die Seite /ˈzaɪtə/
If the S is at the beginning of the word followed by a constant, the sound is almost always a /ʃ/.
Examples: der Stein /ʃtaɪn/, das Spiel /ʃpiːl/, stellen /ˈʃtɛlən/, die Schablone /ʃaˈbloːnə/
There are a few exceptions, but the only consonant pairs with s that don’t make the /ʃ/ sound that you’ll find in non-loan words are sk /sk/ (except for Ski /ʃiː/ and derived words like Skifahren) and sz /sts/.
Examples: skizzen /ˈskɪtsən/, die Szene /stseːnə/

Between two vowels: In this case, the s is pronounced /z/ and the vowel before it takes the “long vowel” pronunciation:

Diphthongs (ai, au, ei, eu, ie, äu) are unaffected by this.
Examples: der Hase
/ˈhaːzə/, der Esel /ˈeːzəl/, lösen /ˈløːzən/, die Düse /ˈdyːzə/

After a vowel, before a consonant: Unless it’s a compound word, the s always here takes the /s/ pronunciation, and the vowel takes the short sound.
Examples: der Ast
/ast/, Mist /mɪst/, die Post /pɔst/, die Brust /brʊst/
Note: in this situation, s is no different from ss in pronunciation, and in some cases there are two different words, one with s and one with ss (for example, Mist and misst)

Ending a word: At the end of a word, s is always /s/. There is no one constant rule about the vowel.
Examples: des /dəs/, das Glas /das glaːs/, dass /das/, and almost every masculine or neuter noun in the genitive case e.g. des Schülers /dəs ˈʃyːlɐs/
Note that das, the (definite, reflexive, and demonstrative) pronoun and dass, the conjunction, sound identical - many fluent German speakers make the spelling mistake between the two.

SS

Beginning a word: ss never begins a word.

Anywhere else except compound words: ss is simpler than s. In every situation other than compound words, ss is pronounced /s/ and the vowel before it takes the short pronunciation.
Examples: verpassen
/fɐˈpasən/, (das) Hessen /ˈHɛsən/, genossen /gəˈnɔsən/, der Russe /ˈʁʊsə/
One exception: the slang term der Assi (thug/gangster) is pronounced /ˈazi/, because it’s from the word asozial /ˈazotsi̯aːl/

Compound words: Compounds words kind of screw up this rule, because when adding words together you’ll often get a double S even when each S is performing a different role and we don’t actually have the ss consonant pair. Most commonly, but not at all exclusively, these will end up being a compound of a word ending /s/ and a word beginning /ʃ/.
Examples: die Abfahrtsstrecke /ˈabfaːtsˌʃtʁɛkə/, ausschließlich /ˈaʊsʃliːslɪç/, die Liebesszene /ˈliːbəsˌ(ʔs)tseːnə/ (By the way, any compound word where the first word ends with a consonant and the second word is Szene is cruel af. Try saying Tanzszene /ˈtants(ʔs)tseːnə/ five times fast.)

ß

(the letter is called Eszett or scharfes S “sharp S”)

Beginning a word: ß never begins a word. Freak out your German(-speaking) friends by replacing the s at the beginning of words with ß (der ßalat, ßehen, ßechs)

Anywhere else: ß is even simpler than ss. In every situation, ß is pronounced /s/ and the vowel before it takes the long pronunciation.
Examples: aßt
/aːst/ (notice the difference between aßt and Ast), beißen /ˈbaɪsən/, genießen /gəˈniːsən/, draußen /ˈdʁaʊsən/

Confusion point with old texts

Up until a point in the 20th century, ss was not used apart from compound words, and instead ß was used. Therefore, you might see old texts saying (or old people writing) words where an ß follows a short vowel like beßer instead of besser /ˈbɛsɐ/, Prozeß for Prozess /pʁoˈtsɛs/ etc. If they were pronounced according to the modern rules, they would be pronounced /ˈbeːsɐ/ and /pʁoˈtseːs/.