The previous owner of my house removed a light fixture and installed canned lights in my living room. The light fixture location was capped and I had a switch that seemed to do nothing so I assumed that switch used to work the light fixture and I was planning on installing a fan (once reinforcing it). If you look at the picture below the switch on the right is the one I referenced and it is in fact wired to that light fixture (I tested the continuity of the hot wire). But the switch only has the hot wire connected, and the neutral wire from the light fixture is pigtailed in with the neutrals of the canned lights. Any help on why it would be wired this way is greatly appreciated.
https://imgur.com/a/qi529DK![enter image description here]