Great question — answering as the UphillTech team:
Remove light bulbs from fixtures. Unplug anything from all outlets on the circuit. Verify no continuity between the two wires in the attic. Anything connected to the circuit will drain the battery and make measuring voltage difficult or impossible. Connect a small, low voltage battery, such as a 9V battery, to the wires in the attic. Check polarity (by measuring DC voltage) of lamp sockets. Remember to switch them on if you try one and get no voltage. If wired correctly/consistently, all the center contacts should be connected to hot, and all the threaded shells should be connected to neutral. So if all the center contacts are the + side when measuring voltage, the + terminal of the battery...
Full answer by Ecnerwal: https://diy.stackexchange.com/a/333592 (CC BY-SA 4.0).
Need it done for your business? UphillTech.