I had endoscopic sinus surgery and septoplasty. How long will headaches last after the surgery?

Less than 2 weeks. Headaches can occur following sinus surgery but usually they should be gone within a short amount of time. If yours are persisting you need to let your surgeon know and if despite whatever he or she does, they continue, a second opinion is always a good idea.
Difficult to say. It is difficult to answer your question because we do not know the extent of your surgery or the disease associated with it. For example, if you had massive nasal polyps, the rhinologic surgeon might have uncovered the roof of the ethmoid sinus (sinus between the eyes). Sometimes, it may take several weeks for this to heal. Best thing is to consult your surgeon to rule out a complication.