1) Initiative is rolled - by everyone.
2) Surprise is determined - this is *individual*; some enemies may be surprised, some may not be. Each individual creature may or may not be surprised, which your DM determines based on the situation (usually by comparing the passive perception of each creature against the stealth checks of the hiding ambushers).
3) Initiative is run as normal. A creature that was determined to be surprised cannot more or take actions on their turn, and cannot take reactions until their first turn ends. They recover from being surprised at the end of their turn.
Oh, that's interesting. In that case I guess it's working as intended; it would explain why sometimes the enemies are all surprised and I basically get a freebie round, and sometimes they actually get to attack back immediately.