One of my cats likes to fall asleep with her head on my arm, so if I haven't made sure I can reach the lamp to turn it off with the other hand, without moving too much, then I'm afraid the lamp stays on for as long as I can bear it.
I once spent a week sleeping on the living-room sofa because the same cat was confined under the coffee table (I chicken-wired it to make a cage for her) after an operation, as a kitten, and I didn't want her to be on her own at night, in pain and not understanding why she was stuck in a cage. My vet said I was mad. I was quite surprised at her attitude, actually!