A ruler would risk loss of position if he were seen associating with the revolutionary peasant preacher. Maybe, it was night in the life of Nicodemus, a time of confusion. Maybe emptiness, meaninglessness, and pain were keeping him awake. Nicodemus was an exceptionally bright and learned man. He knew the laws of God, but he was certainly in the dark when it came to understanding the miracle of God's love.
Laws are more logical than love.
Demanding what ought to be is easy for humans. Loving when the ought-tos aren't happening is impossible for mere people. That takes miracles. But, you precious Children of God who are accustomed to miracles. The illogical, unlikely wind of God's Spirit has charged this room with power before.