Niya niya (にやにや) is a sly grin: smiling to yourself, as if you know something no one else does.
Your friend is reading a message and can't stop smiling at the screen. You lean over: “What's so funny?” That smile is にやにや.
What it means
にやにや is a smile you can't hold back, usually about something you are thinking of. It can be happy, a bit embarrassed or a bit mischievous, but it is never quite innocent. People who see it want to know what is going on.
How to use it
Use it with します: にやにや します, にやにや して います. It describes how someone looks, so you often hear it as a question or a tease: なにを にやにや して いますか.

ふじさん、なにを にやにや して いますか。
Fuji, what are you grinning about?

な、なんでも ないです!
N-nothing!

…ほんとうですか。
...Really?
Close cousins
にこにこ is a warm, open smile that makes everyone feel good. にやにや is the same shape with one vowel changed, and the feeling changes too: it is a smile with a secret. にやり is a single quick smirk, the villain's kind. くすくす is a quiet giggle you try to hide.
In manga and anime
A character daydreaming about a crush gets ニヤニヤ written beside a slightly silly face. A friend who has just found out about it gets the same ニヤニヤ, and the teasing begins. A villain with a plan gets ニヤリ.
Can you use it?
Yes, with friends. Be careful saying it about someone you don't know well: it can sound like you think they look a bit creepy. For a nice smile, say にこにこ.
