This question does a good job explaining how surprise attacks work for the most part, but I'm not sure how such an attack would actually play out, here is what happened in my last game:
There was a group of enemy creatures, and the heroes were successfully avoiding notice nearby (I guess they were effectively hiding), watching the creatures and planning what to do while unnoticed.
After agreeing upon a plan, one of the PCs made a ranged attack against an enemy. This catched the enemy flat-footed against the attack, but the PC became observed by everyone after resolving it.
I decided to roll initiative and start the encounter at this point since it made the most sense at the time, but after reading the rules I'm not sure if this played out correctly.
Should initiative have been rolled just before the attack? This seems unfair to the heroes, since according to Avoid Notice it would force another Stealth check to see if the enemies notice them, but the heroes have not done anything yet to break their hiding. And then, if they succeed on the check, what is the point of the enemy turns?, since the heroes are still unnoticed, the enemies would do nothing until the heroes act.
This leads me to believe that the encounter should have started at the moment the heroes spotted the enemy: initiative is rolled according to Avoid Notice and if the heroes succeed on the Stealth check against the Perception DC of the enemies, they remain unnoticed. And all the watching and planning would have ocurred in Encounter Mode (a very long and pointless encounter for the most part).
If this is the correct approach, the heroes could decide to coordinate and attack all at the same time, by delaying to set their turns one after the other, and readying an attack just before the start of the turn of the first hero, so everyone would use their readied attack and then have their full turn before any enemy gets to act. Is this right?