He is ordered by Claudius to discover why Hamlet is acting mad. Polonius suggests that Hamlet is acting crazy because Polonius wouldn't allow Ophelia to see him. He attempts to put his theory to the test, but Hamlet confounds him even more. Polonius, although suspecting something afoot, could only say "Though this be madness, yet there is method in it" - Act 2 Sc.ii.
While Polonius was hiding behind the curtains in Gertrude's room, Hamlet comes in and sees someone hiding there. Without checking to see who it was first, he stabs Polonius, thinking it may have been Claudius. Polonius dies, leaving Ophelia to go crazy and Laertes to demand revenge.