My wife can’t spell and I just tell her “hey just memorize how to spell everything”. I’m convinced that’s what we all actually do, at least with English.
Back when I worked in support and had to do a lot of chat/email communication, I did this for a lot of words - "environment" being one of the most frequent ones. Many years later, I realized that my "mispronunciation" for spelling it was actually closer to some people's pronunciation! I never realized it, but I was only familiar with the southern pronunciation, which totally lacks the second "n" sound ("in-vire-mint").
I think there's some sort of "deep learning" analog going on, where we memorize a lot and it subsequently leads to generalization (that can still sometimes overfit and be wrong). For me anyway, I write and read a lot, and having broad exposure to words coming from different root languages etc gives a good feeling for what spellings make sense. At the same time, I'd guess the majority of my adult vocabulary has come out of books, or at less adjacent to them, so it's pretty uncommon to be writing a word I've never seen before
I used to read a lot in my teens and I agree. I could spell difficult to spell words I didn't even know I knew how to spell, and it felt like at some level, I didn't explicitly remember how to spell them at all. It seemed pretty much impossible to give me a valid English word and have me misspell it. I could feel them sort of matching a cluster in my brain, like "by the way it sounds, it has to be like one of those words that does this thing"--I didn't think that, I could feel it as I spelled it out, and I'd have no conscious idea what the grouping is. I'm sure my brain had an unlabelled network of neurons that knew how to spell words in English that came from old Norse but got mangled by French influence and crazy random stuff.
People underestimate the amazing pattern recognition the brain can do if you feed it obscene amounts of input.
I think the popular wisdom in the US at least is you learn phonics and learn patterns which is how you learn to spell. As if there’s some “trick” to it. But especially in English there’s a million different things that don’t follow the supposed rules. So just memorizing by virtue of being constantly exposed to words is the way to go. Eventually you can’t help but be mostly literate.