I failed one portion of the NE exam. Do I have to retake both sections

You can just retake the failed portion, but there are limits. You have three attempts or six months to pass the other section, whichever comes first. If you cannot pass the other section within this window, you have to retake the full exam. Each time you go to retake, you must reapply for exam eligibility.