You can write a term paper as an answer to your question. There are many factors that play role: stress; environment (surrounded by what); how a community of native speakers pronounce a word in a certain way. look at s: at the start, medial, at the end at the end: it could be a inflection like plural, possessive (here you can google to find general patterns) at the start of a word: i have yet to encounter with /z/.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.