Most likely there is some sort of motion or presence sensor that turns on the lights which then turn themselves off after some time or no more presence is detected. There are also small wireless switches that could be used in place of the actual wall switch.
I have done so in my apartment for example. Since the bedroom light switch is for some reason outside of the room I taped it down and put a wireless switch in a more reasonable spot. Another example is the hallway light, which only turns on by motion sensing when the sun is starting to go down.
And even the living room automatically adjusts lights based on the playing status of the AppleTV (playing = dim, pause = brighten up a bit).
Oh and the staircase, haven't found the motivation/courage to climb up 10m to the ceiling to switch out the ye olde light in there :D Maybe this year?
The Living room would need two presence sensors that talk to each other in a smart way (a big room, one isn't enough) and I haven't yet found the semi-manual way of adjusting the lights via phone/Siri to be too cumbersome to bother.
Let's hope you don't have to get to the bathroom quickly late at night...