Context, context, context!
Briefly: the simple past is used to narrate past events. The present perfect is used to mention past events which give rise to a present state which is of present interest.
The children played in the sandbox for a while, then moved to the swings. At four o'clock their mother called them inside because it looked like rain.
The children have played in the sandbox and left their toys there. Tell them to go bring their toys inside.
However, the second could also be expressed with a simple past, and would probably be expressed with a past progressive. Play is an activity verb, which doesn't accommodate the perfect all that well. This example, with a telic verb (one which has a distinct change of state in its meaning) may be more instructive.
The children finished their chores, then went outside to play until their mother called them in.
The children have finished their chores; I am going to let them go outside and play now.
In general, the choice of grammatical aspect is, unlike tense, not strictly delineated. You can often choose between two or more aspects to express the same basic idea, because aspects have less to do with denotation, and more to do with connotation. In other words, aspects carry implications and tonality, but they have less effect on the literal meaning of the sentence. As a result, the "correct" aspect is often a matter of opinion and interpretation.
So, let's go through these examples:
John hasn't studied very well this term.
This is present perfect simple, as your book says. It carries the connotation that John's poor study habits are either already causing problems for him, or are likely to cause problems in the near future. For example, you might continue the sentence like this:
John hasn't studied very well this term, so now he's at risk of failing the exam.
The emphasis is on the consequences of the action, even if those consequences are not explicitly stated.
Now, let's look at your other example:
John hasn't been studying very well this term.
This is present perfect continuous. Since it's still a perfect aspect, it still conveys the same emphasis on consequences. However, it also suggests that there is still time for John to change his study habits. It sometimes shows up in cases where the action is interrupted or altered, as in this continuation:
John hasn't been studying very well this term, so the teacher gave him an extra assignment.
We could also have something like this:
John hasn't been studying very well this term, but he could still catch up.
These continuations are (for the most part) also possible with the simple perfect, but they make more logical sense in the context of the continuous perfect.
Having said all that, you generally cannot use the present perfect continuous in cases where the action is far in the past, or otherwise "complete." Similarly, the simple perfect is usually considered less appropriate for a continuous action which is still ongoing (although, as in our examples above, it can sometimes be used with habitual or repeated actions, especially when those actions are unlikely to continue).
Best Answer
I'd say:
I have finished the essay I had been writing.