First, it's important to separate out spelling. You don't have to go to the hardcore "written language isn't part of language at all"—it's at least plausible (and empirically testable) that literate people store spellings as part of their lexemes in the same way they store phonology, class information, meaning, etc., and that they store orthographic rules in the same way they store morphosyntactic rules. But the spelling is still secondary, not primary. When you're learning new words, you generally learn the word first, then learn or work out its spelling,1 and the same goes for new coinages getting into the language.2
So, let's start by ignoring spelling, and dealing only with the spoken English language.
The words "hat" and "hate" are both perfectly regular. In both cases, just as with any other root ending in the /t/ phoneme, the 3.sing.pres suffix is pronounced /s/, the past suffix is pronounced /id/ or /əd/, etc. And the exact same goes for "hate". And the same goes for the noun sense of "hat"—the plural phoneme is pronounced /s/ after any root ending in /t/.
Notice that words with different final phonemes handle these suffixes differently. For example, "dog" takes a /z/ for 3.sing.pres, "axe" takes a /əz/. The rule isn't quite as simple as "add /s/", but it's still pretty simple, and these words all follow the rules regularly.
The word "tooth", on the other hand, is irregular—to pluralize it, you don't add the /s/ phoneme, you change the last vowel. Historically, many nouns pluralized this way, with regular but somewhat complicated rules. The same goes for verbs like "sing/sang/sung".
Traditionally, this is treated as nothing more than history. When you learn modern English, you just learn that "tooth" has a plural form "teeth".
When you try to construct "tooth + -s", something called "suppletion" happens—you remember "teeth" and it blocks "tooths" from being constructed.
The same happens for other historically productive classes, like "child + -s" being suppletively blocked by "children" (notice that this has an unusual suffix, and also has a vowel alternation in the root).
Some theories instead insist that quasiregularity is a real thing in our language, not just a historical fact. For example, why did most American dialects convert the past tense of "dive" from "dived" to "dove" if there isn't some "strong verb" rule, or some process of analogy, or something like that, active in our minds/society/whatever? Why can we jokingly make plurals like "moose/meese" and every native speaker knows what we're doing?
When you get to spelling, there are different ways to handle things. Some languages try to spell things as phonetically as possible, but English instead tries to spell things as morphologically as possible. So, we don't write "cats, dogz, axiz" because they all have different phonetic endings, we write "cats, dogs, axes" because they all have the same morpheme. English is far from perfect in this, but it's a general tendency.
This can make the spelling rules somewhat complicated. For example, to get "hatted", you need a rule something like "when adding -ed to a word ending in a short vowel and a single consonant, double the consonant".3
But "hat" and "hate" are perfectly regular in their spelling. The rules are more complicated, but they can not only be written down, they can be, and are, taught to millions of children, who learn to apply them.4 We don't have to memorize "hatted" and thousands of other past-tense spellings for verbs ending in a short vowel and a "t", they all work the same way. We do have to know which single-letter vowels really are "short vowels" to know when to apply this rule, but that's something we already need at least roughly in our heads in order to pronounce them. And then, we only have to memorize the small number that break the rules.
And "tooth" is just as quasiregular in its spelling as in its pronunciation. We don't have a rule that tells us how to spell the vowel alternation, so you have to memorize that "teeth" is the spelling of "teeth". But we do usually handle this kind of irregularity by keeping as much as possible the same (notice that "children" keeps the whole root spelled the same despite pronouncing it differently) and spelling the irregular bits as… something like the paradigm spelling for the sound (but a few centuries out of date), so the vowel in "teeth" is spelled "ee" because that's how "long e" is usually spelled, and the suffix in "children" is "ren" because syllabic "r" is usually spelled with an extra "e".
Is this quasiregularity part of our actual spelling system, or just a historical fact? The question is pretty close to the one for spoken language. After all, anyone who hears "meese" as the jocular plural of "moose" would spell it that way, and anyone who sees that spelling would interpret and pronounce it that way. But, on the other hand, it's definitely not a rule that can be applied regularly, like the "plural is spelled with s except in these cases where it's spelled -es dropping the final vowel letter if …" that just always works unless it's suppleted.
At any rate, to work out a rule to transform any English noun into its plural, there are two approaches.
The first approach is to stay purely within orthography: take the rules that are taught to children about when to double consonants, etc., and then just add in special cases for the irregular words.
The second approach—the one most linguists would probably instinctively pick—is to go from orthography to spoken language, apply the simpler and more regular (and better studied) rules there, then spell the result. Unfortunately, that may actually be a lot more complicated in English—going from orthography to speech and back may add a lot more to the problem than using the simpler rules subtracts.
And either way, you have a choice for how you want to handle quasiregularity. For example, you can just treat "sing", "sink", and "stink" as sui generis irregular verbs and store the full pattern for each one. Or you could have a "subroutine" that does i/a/u vowel alternation and just store that "sing", "sink", and "stink" use that pattern.5 It doesn't really matter what English "actually does" for your purposes; whatever's easiest to record, whatever makes the most usable record, or whatever you can turn into code, or… whatever the most important thing is for your end goal, decide based on that.
1. Cases of precocious readers certainly do happen, of course. Plenty of 80s kids read Dungeons & Dragons books and learned all kinds of uncommon words that they knew how to spell, and could use perfectly well in a written sentence, but had no idea how to pronounce. But it's not the way most words are learned.
2. Again, this is just the usual case, not the universal case—people were writing LOL for years before anyone pronounced it as a word rather than an acronym. But it's still clearly the usual case.
3. How this regular rule relates to the much more general but only quasiregular rule about double consonants for short vowels is up for debate, but let's ignore that.
4. Although you probably want something aimed at a complete description, rather than a pretty-close learnable-by-children description. Without checking (I don't have a copy handy), I'd bet that CGEL probably covers the spelling rules, and that if it does so, it does a great job.
5. And then, is "sting" a verb that uses that pattern but suppletes "stang"? Or are there two patterns that share part of the table?