The best way to ensure a good grade is to make sure you deeply understand the topics you are supposed to learn.
It is of course important to remember the routine solution methods, but you should also be able to tell intuitively and at a glance why these methods work and where any given method is applicable.
You of course need to remember some key results, but you should also be able to justify those results — or even better, give a (sketch of a) proof.
The point is that if you understand the topic well, you can quickly and reliably reconstruct all necessary information.
If you remember the topic as a whole, it does not matter if you forget some little details.
I have a PhD in mathematics and I still occasionally forget elementary things, but I can fill the gaps.
For example, if you remember the differentiation rule of quotients but you are not sure about the signs, test it with some simple functions — the sign in the general case must be the same as in any example.
Teachers often focus on telling what is true (differentiation rules, ways to calculate limits), but I strongly recommend learning also what is not true.
For example, if $\lim_{x\to\infty}f(x)=0$ and $\lim_{x\to\infty}g(x)=\infty$, do we necessarily have $0<\lim_{x\to\infty}f(x)g(x)<\infty$?
If you are aware of some common "false rules" that are easy to believe, you can recognize when you have made a mistake.
When solving a problem, try to make sure that you understand what you are doing at all times and test your claims in special cases if you are unsure.
(The last sentence may sound trivial, but many students seem not to do this.)
You will make mistakes and you will forget things.
We all do.
If you want to make yourself good, try to make yourself robust — so that if you forget something, you can reconstruct it based on something else, and if you make a mistake, you can recognize it yourself.
So far I have answered a question like this: "What kind of a student will almost surely get perfect grades?"
Another important question is: "How does one become such a student?"
For one thing, you should know what you want to become.
If you really want to understand mathematics well, examine your own skills.
Ask yourself what are the most important ideas, results and methods in higher order differentiation.
If you cannot answer with confidence and give a couple of examples demonstrating these ideas, you need to work more.
For another thing, do not limit your scope to the present course if possible.
The big picture you create for yourself shouldn't be only about the course at hand, but mathematics as a whole.
I would even suggest not trying to remember which course a given topic was covered in and which course you are having at the moment.
The borders between different courses are somewhat artificial and you don't need to respect them.
Also, if you have the extra time, look what is coming ahead: find a follow-up course that builds on your current course and take a look at its book.
When I was in high school (or the closest equivalent in Finland), other students thought that I didn't have to work at all because I understood quickly and could solve problems quite intuitively.
The reason was that I was working ahead of them: I had already read the book of the next course, and that gave me plenty of context and motivation for the present topic and I could focus on building a solid big picture.
I was working hard, but I was working on something different than others.
It often happens that you properly understand something only when you have applied it in something else; no one masters the last thing they have learned.
As JPBurke suggests, working in a group also helps.
But a group is not strictly necessary if you can't find equally motivated friends or suitable ways to collaborate.
What you do need is someone to ask from if you don't understand something on your own.
It can be a fellow student, a teacher, an older sibling or anyone willing to help.
I realize that this answer gives somewhat grandiose goals.
A perfect understanding is too much to ask for, but I do suggest putting goals in this direction.
For me playful interest and idle curiosity in mathematics is what kept and still keeps me going; there is no need to be serious in order to become good.
The most valuable thing you can have when trying to get good grades is a passion to understand.