What @jerv said. Cats sleep more than almost any other mammal, generally up to 16 hours a day. Cats are “crepuscular,” which means they are most active at dawn and dusk. They do their hunting at these times because their prey is most active then. During the heat of the day, the cat is asleep. Although they have good night vision, cats can’t see in complete darkness, so they tend to sleep then as well.
Many house cats do sleep at night and have more waking hours during the daytime when their humans are up and about. However, you can easily convince a cat to stay up at night and sleep during the day if 1) you leave it home alone all day, and/or 2) when it does get you up in the middle of the night you reward it by feeding it, petting or paying attention to it.
The staring at nothing that cats do so much of is actually the cat concentrating on tiny sounds that we can’t hear while conserving energy for the time when a prey item comes out of hiding.
As someone else said, actually cats are magnificent mathematicians. When a cat is “staring at the wall” they are actually calculating the probability curve of every atom in the paint for fun and as the equivalent of mental weightlifting. (with apologies to Terry Pratchett)