I'm gonna reiterate Ichit's suggestion:
Think about a game or genre you really like. Then consider, if you were to make a game like that, how would that look? Maybe you'd prefer some mechanics to work differently, maybe you'd like a very different type of story, or maybe you'd like to mainly change the visual style to something completely different? What sounds like fun to you?
Another, but similar idea, is to mix games you like: Maybe your two favourite games are Call of Duty and Tetris... How would you combine those two?
A third idea is to take a game or genre you really enjoy, then change what dimensions the game is viewed and played in: Call of Duty, but it's top down 2D? Tetris, but isometric? Command & Conquer, but you command your army and build your base from an FPS perspective?
I think being able to come up with ideas is practically like a muscle you develop. But remember, even then: Ideas aren't worth anything if you can't put it into practise. And if you're getting into gamedev, I highly suggest starting out with something really small and simple.
As for mechanics specifically, it's all about what's fun and engaging. For example, Halo was originally supposed to be a top down RTS, but then the developers mounted cameras and direct control to the vehicles, and they just found it to be a ton of fun. And thus the Halo we know was born. So don't necessarily think about mechanics to much, just try to find ways for your games to be fun - and then that can lead to fun mechanics.