Literally no one knows why domestic cats do anything and they’re lying if they tell you otherwise. That said, cats are predators, with a strong hunting instinct. When a prey animal, such as a mouse, is scared, it’ll often freeze; hiding in plain sight, trying to look uninteresting until the threat has passed. So, when a cat bats a tabletop item, such as a pen or a pair of glasses, they could be testing it to see if it will unfreeze and flee. Think of it as an ‘I wonder if I can chase and chomp it’ test. Also, the cat might just be bored.
HP