Enemy generation is a big mystery to me, too. They USUALLY appear in the same place under the same conditions, but maybe I turned a couple pixels earlier or something and a different enemy is loaded, or another enemy unloads at a different time because of its randomness thus letting something else appear. I have no idea.
The trend seems to be that only so many enemies are generated in a certain order if they're a certain distance from you. They tend not to appear again until you've gone far enough off screen and killed enough other enemies. But in the first room of Blue 3, I kill a bunch of red guys, the cannons, a butterfly, then the 2 spinners, go back to the arch above the beginning and kill another red guy, and the spinners generate next despite having just been killed 10 seconds ago.
For Doom Castle (Palace 3) specifically, I've just got no precise consistency. The spades tend to appear after I hit the buttons near the beginning, but occasionally don't. The Clubs in the corners and start tend to appear after each button, sometimes don't, but sometimes do more than once per button. Maybe some day you can find some memory address that says "This enemy exists here, but isn't active yet because you're too far." I hoped some kind of pattern could be determined, and some kind of dance ritual be choreographed to manipulate this.
I'm hoping I can one day stop saying the run is so luck based, because it's been putting other runners off. :^/ Ironically, "It's not your fault" is a very discouraging assurance.