Massive Alien invasion force attacks earth.
Earth very nearly get wiped out but are saved at the last minute by some fluke.
Aliens "Oh well we see what you did there but, well give up and never come back."
Of course that depends on the nature of the aliens in question. A simple and rather reasonable outcome is that the aliens in question are more akin to nomadic wanders rather than a centralized government, with various unconnected groups of their species slowly spreading out across the galaxy, moving from system to system to gather resources, expand their tribe/fleet, and then push off to the next 'watering hole' they can see from their current location.
Nothing really needs to happen after their defeat. Any survivors just keep moving on, possibly marking 'the demon planet' down as part of their cultural history and appearing as a thing in their literature. A horror story from generations ago where the last 'golden age' of their society ended and they fled to rebuild as best they could and continue on their way, harvesting new planets and spreading their species. There really isn't a reason to 'go back', as everything near earth that was worth harvesting has been harvested/settled/whatever, and the last time they showed up here things didn't go well.
Why would you risk a second attack if you knew that they had already defeated your forces once and nearly wiped you out, and now know even more about you and have more of your technology? Far better and more logical to just run as far and fast as you can, and hope that you never meet a member of that species again. (Maybe fling a few massive rocks towards the system to destroy the planet to be sure, but that might still be stopped, and maybe the pesky humans might use that as an excuse to devote resources to building a fleet of their own and coming after you... Probably just running like mad and hope they forget is the best option. They seem pretty stupid and happy to live on their one little rock in space anyway, and are more interested in killing each other when there isn't some external threat that forces them to band together anyway.)
And of course that assumes there ARE any survivors from that group. Maybe the humans defeat every last one, utterly destroying a whole civilization that was so advanced that the failure of their systems was completely inconceivable to them, and therefore unrecoverable from when things suddenly went so badly. Even if there are other groups of that species out there in space going on their own paths, well, they're basically locus spreading out through systems, and even if they had remained in contact with ultra long range communications, having one fleet suddenly go dark might not be a huge issue to everyone else. Those nearest to them might worry that it was an external threat of some kind, but lacking an actual update or report from them before the end the others could assume that it was some kind of accident, the core of the mothership overloading, or a civil war breaking out, or even just their communications system going dark. Everyone else could have their own problems and things to worry about, so why spend resources to go look at what happened to some random isolated incident with people you don't really care about?
When was the last time YOU drove up into some remote part of Alaska to go knock on doors and ask why some old prospector died?