The queen with the colonizing fleet is a juvenile queen so she couldn't have produced all the drones for the invasion. That means one queen can control other queens' drones and/or other queens were controlling the drones during the invasion.
When Mazer killed the colonizing queen by targeting her, he proved that Earthlings had intelligence far beyond what the Formic imagined. Once the Formics realized that they made a mistake about the intelligence of the Earthlings they stood down. They were in effect surrendering, and saying we made a mistake trying to colonizing you. We'll leave you alone. That is why they immediately stopped fighting. That is also why the Third Invasion never came. The Formics wanted to act honorably towards the Earthlings once they realized their mistake. This is also what they communicated to Ender.
They felt sorrow for what they had done. They also wanted to understand humans and express that sorrow/regret, which is why they connected with Ender. Ender's understanding through that connection with the Formics is what gave him the empathy/understanding to become the Speaker for the Dead.
Here is the quote where the Formic Queen hoped that humanity would forgive the Formics for their actions (emphasis mine):
What the hive-queen felt was sadness, a sense of resignation. She had noth thought these words as she saw the humans coming to kill, but it was in words that Ender understood her. The humans did not forgive...
The next page it is more explicit that the Formics didn't view humans as sentient beings, just like we don't view plants as sentient beings. Emphasis mine in the following:
We are like you the thought formed in his mind. We did not mean to murder, and when we understood we never came again. We thought we were the only thinking beings in the universe until we met you, but never did we dream that thought could arise from the lonely animals who cannot dream each other's dreams. How were we to know? We could live with you in peace. Believe us, believe us, believe us.
So as you can see the Formic Queen was trying hard to convince Ender that they didn't know they were killing sentient beings. Once they realized humanity was sentient they stopped their plans to colonize our solar system. Of course this might be some sort of elaborate mind game to trick Ender into saving their species so they can fulfill their dreams of conquest. I don't think that is the case though because the author used the changed mindset this experience gave Ender as the basis for the sequel and a new positive religious movement. Furthermore to my knowledge the Formics never again are featured as a threat in any subsequent books after Ender reseeds the Formics.
You can verify the quotes in photos I took of the pages present in a previous edit.