In your 2) I need to have done it is a present-tense use of need and is only meaningful with a future reference, such as I need to have done it by Friday, because I'm leaving town on Saturday. I needed to do it is a past-tense use of need and refers to a past necessity, such as *I needed to do it right away, because I was to meet the client that afternoon.
The two sentences in your 3) mean the same thing. Note that the first sentence employs need as a modal, taking the bare infinitive (without to). This is an old use which in effect treats the present form as immutable, like must: the have done construction is not a true perfect but a perfect employed as a modal past marker. Need have VERBed has been steadily declining since about 1900, and is nearly defunct now.