Sleep is controlled by AI Packages.
The Lydia Actor (actually called "HouseCarlWhiterun") does have a default (sandbox) package that includes sleep, so technically she would/could sleep.
However, she is a very busy girl and it is very likely that her default package never kicks in (or at least, not very often).
Even if/when it does kick in, she would need to be in a place with a bed that she can use (either completely unowned or owned by her).
If you were to mod her a bed she owned in a player-house and if she was just sandboxing about on her default package (not following the PC, not involved in a quest and so on) then - at some point during the day, she may decide to go for a kip.
However, in order to guarantee - as far as possible - that any NPC sleeps, they need Sleep adding to a dedicated Sleep-Package (with a timed schedule) ... as sleep is no more important, without a schedule, than eat, or sit, or sweep.