How to locate ceiling joists?
Assuming that your ceiling is drywall attached to the joists, you proceed in the same manner as finding studs on vertical drywall.
I like to use an electronic stud finder to get a rough position for the joist. I tap on the drywall at that position to confirm that it sounds solid. Then I search along that rough position (parallel to the orientation of the joists) with magnets to find the screws/nails that attach the drywall to the joist. I like to identify at least two screws/nails before being somewhat confident that I've precisely located the joist. Then I choose the exact position along the joist where I'm going to mount, and drive a nail through the drywall, hopefully hitting the joist, to confirm that it really is where I think it is. Then I remove the nail and mount whatever it is at that point.