Updated Sept 20, 2016, with better data on Protictis and more taxa added to the mammal clade. See Part 4 here. It solves many of the problems attending the origin of bats.
One of the most popular blogposts here,
year after year, has been the post on bat origins back in 2011. Nothing has changed since then except for the fact that I have added a few bats and kin to the large reptile tree (Fig. 1, subset) and Protictis has moved to the Carnivora following better data.
Phylogenetic miniaturization contributed to bat origins. The teeth became better adapted to insect eating. The larger scapulae and clavicles anchored larger muscles. The ulna became reduced relative to the radius and fused to it. The hands became enlarged. Membranes spanned the forelimbs and hind limbs. This is the only flapper that did not have an obvious bipedal phase.
It is still a mystery what evolutionary events spanned these two taxa. The rest has to be imagined.