dnd 5th – How does the initiative work when teleporting to combat?

I think you're confused as to how surprised works:

The GM determines who might be surprised. If neither side tries to be stealthy, they automatically notice each other. Otherwise, the GM compares the Dexterity (Stealth) controls of any person hiding in the Passive Wisdom (Perception) score of each creature on the opposing side. Any character or monster who does not notice any threat is surprised at the beginning of the game.

If you are surprised, you can not move or do anything during your first round of combat and you can not react until the end of this turn. A member of a group may be surprised even if the other members are not.

The GM decides who is surprised, not the role of initiative.

Here is how this event would unfold.

  1. Wizard teleports to fight
  2. The initiative Everyone rolls
  3. Towers start in the order of initiative
  4. Anyone who is not surprised can act while those who are surprised do not pass their turn.
  5. Assuming the PCs no longer teleported before the end of turn 1, turn 2 would begin
  6. The turns begin to take place in the order of initiative, no one is surprised

EDIT to deal with scenario 3:

The wizard can not prepare an action out of combat, so he can not prepare the teleportation spell before the fight begins.