Editors sometime explain that the ape tried to imitate the birds and broke his neck when he tried to fly, but I don't see the parallel to Gertrude's situation. All I get is that Hamlet seems to be telling his mother that she will put herself in danger if she reveals to King Claudius that her son is not really mad, but I don't understand just what danger Hamlet has in mind.