

The single, simple answer is the one that you don’t want to hear: There is no clean split. Bats are a large and diverse group of flying mammals just like birds are a large and diverse group of flying dinosaurs.
The simplest answer I can come up with (because it’s actually a very complicated and convoluted topic that I wouldn’t truly do just anyway) is: Most birds can fly because they are an offshoot of one group of dinosaurs (avian dinosaurs) that survived the last great extinction when their non-flying non-avian dinosaur relatives did not. Basically the ones that couldn’t fly mostly went extinct. And mammals mostly don’t fly, which is possibly because several groups of vertebrates beat them to it and essentially filled all the niches that would have been available to flying animals, kind of blocking that path for them.
Obviously that’s nowhere near the full story. There are lots of other factors at play, like some of the peculiarities of mammalian and dinosaur physiology that made one group better suited to flight than the other, ramifications of the great extinction that killed non-avian dinosaurs as well as most large animals in general and whole swaths of other species, and so on.
My general guide on this:
If you didn’t hear me the first time, I assume it’s 100% my fault.
If you didn’t hear me the second time, I assume it’s 50% my fault.
If you didn’t hear me the third time or there after, I assume it’s 100% your fault.