We're programmed to fear the dark (and the predators it conceals) and so things associated with night have become scary. Bats live in dark caves and other places where we might place the dead, such as crypts and churches, further reinforcing a perceived link.