Patience !!! lot of patience !! lots and lots of patience.
By far one of the most technically involved photography.
I use two method to do it.
Illuminate them solely using flash, whilst the shutter is held open on a long exposure. To achieve this, I operated the camera in continuous shooting mode, with shutter speeds of between 10 and 15 seconds (depending on how many bats I was expecting). With long exposures, there is a possibility of getting more than one bat in frame at a time, which can be used to great creative effect.
Connect sensors directly to camera and let it click whenever the beam breaks.