Then why did they file the cases? Did they not realize that they would need to present evidence under oath?
I'm not sure what you are trying to imply. Yes, they were going to have to present evidence. They didn't have any, and that's also why they didn't actually allege fraud. And that is why the cases were thrown out.
If you're asking why anyone paid them to file unwinnable cases: So there would be lawsuits to point to, and for the (minuscule) opportunity to have a (Trump-appointed) judge create some kind of win (again to point to it).