One chart explains almost every Thai tone. Find the class of the syllable's first consonant, check whether the syllable is live or dead, then see what each tone mark does. Marks that aren't used with a class are shown as —.
Live or dead? A live syllable ends in a vowel or in one of the smooth sounds m, n, ng, y or w — your voice can keep humming and stretch it out, so it can comfortably carry any of the five tones. A dead syllable is chopped off short: it ends in a p, t or k sound, or in a short vowel, and that sudden stop restricts which tones it can take.
That is the whole trick behind the chart. The tone marks themselves never change — mai ek is always the same little mark — but the result depends on the class of the first consonant and on whether the syllable is live or dead. Learn to spot the three classes in the grid above and you can work out the tone of almost any written Thai word, even one you have never heard spoken.