Motivation+of+Hamlet

Why does Hamlet decide to pretend he's insane?