Here's why:
* It modifies a verb: It tells us how or to what extent something is done. For example, "You don't *necessarily* need to be a professional chef to make a great meal."
* It can modify an adjective or another adverb: "It's *necessarily* a difficult task" (modifying the adjective "difficult").
* It can be used to indicate a logical consequence: "If you're going to the party, you *necessarily* need to be home by midnight."
Let me know if you have any other words you'd like to analyze!