Hmm-you're covering a lot of ground here!
Let's look at some of the sentences you give:
It was not necessary to check all data but I did it anyway.
May I change this sentence a little, so that my explanation will be clearer?
It was not necessary to type my essay but I did it anyway.
I didn't need to do it, (but it helps me practice my typing.)
I didn't have to do it. (The teachers will accept handwritten assignments.)
You will hear speakers use both interchangeably; but "have to" has a sense of "must", it is a requirement.
Look at this sentence:
I have to write an essay on Global Warming, so I will need to go to the library and read up on it.
It is a set requirement that you hand in the essay. To help you, you will consult books in the library for information on the subject.
As I said, sometimes we use them interchangeably. Look at this sentence.
"I have to write an essay on Global Warming. I need to get it done by Thursday."
I could have said, "I have to get it done by Thursday, because that is the deadline."