Which particle for "mitai" みたいに vs. みたいな

Okay, having a lot of trouble distinguishing when to use the ni vs. na particle in connection with みたい for expressing similarities. The English explanation makes a ton of sense in the abstract. Use “na” when describing a noun (and mitaina becomes an adjective), and “ni” when describing a verb or adjective (and mitaini becomes an adverb). Simple enough.

But the examples don’t map to that. “Easy to crack, just like an egg” is given with the “ni” particle, even though the comparison seems to be between the unknown object and an egg (both nouns). Similarly, “I want to teach Japanese, just like Koichi” is also given with the “ni” particle, though I also would think that would be an adjective. All of them seem to be comparing nouns, and all of them take the “ni” particle.

What am I missing?

So the thing being compared in these examples is often the whole phrase after みたいに, so に is used because it’s a ‘verb phrase’ if you like, not a noun

For example,
卵みたいに割れやすい → ‘egg’ is being compared to ‘easy to crack’
サンドイッチみたいに、パンに挟んだ → ‘sandwich’ is being compared to ‘put between bread’
山が砂みたいに崩れた → ‘sand’ is being compared to ‘crumble’ (as for the mountain, it’s crumbling was like sand - might be a way to think of this translation)
こういちみたいに、日本語を教えたい → ‘koichi’ is being compared to ‘teaching japanese’

Additionally, where would the な go in most of these sentences if you were to try and use it? What would be after the な in the first sentence, for example?

In all of those sentences, it’s saying the verb “is done/happens to” something in a similar way as it does to the thing みたい is attached to. That’s why it uses the adverb みたいに instead of みたいな.

Even in the English sentences, the “like” goes with the verb. You can remove the stuff in between and say “Easy to crack like an egg.” or “I want to teach like Koichi.” You’re saying how you want to do that verb, with “like an egg” and “like Koichi” being adverbial phrases that cleanly map to “卵みたいに” and “こういちみたいに” and modify the respective verbs.

Contrast this with something like one of the みたいな examples:

先生みたいな人になりたい。
I want to become someone like my teacher.

Here, in both the English and Japanese, the “like my teacher” and “先生みたい” are adjectival phrases that modify the noun they go with (someone/人).

In short, if you’re saying that one thing is like another thing, you use みたいな, if you’re saying something is done or happens in a certain way, you use みたいに.