As an adjective:
* It is necessary to bring a valid ID to enter the building. (Indicates something is required)
* The team made a necessary adjustment to their strategy. (Indicates something is important for success)
* She didn't feel comfortable sharing her personal information, even if it was necessary. (Indicates something is unavoidable)
As an adverb:
* The doctor said it was necessary for her to stay in the hospital overnight. (Emphasizes the importance of something)
* We only discussed what was necessary to complete the project. (Indicates a focus on what is essential)
* He worked tirelessly, necessary to meet the deadline. (Indicates the reason for hard work)
In a phrase:
* It is not necessary to finish everything today. (Expresses something is optional)
* The tools were deemed necessary for the task. (Indicates a judgment of importance)
* They made every necessary preparation for the trip. (Indicates comprehensive preparations)
In a clause:
* It was necessary that they finished the project on time, or they would lose the contract. (Highlights the importance of something)
* They believed it was necessary to make a change, and they did. (Indicates a decision based on necessity)
Remember that the context of the sentence will determine the exact meaning of "necessary."