For what it's worth:
I just memorize one Pythagorean identity and one of the sum identities. Many of the others (besides the obvious ones: the reciprocal, periodicity, and Pythagorean) can be derived
starting with one of the sum formulas.
So, you could just memorize how to derive them. Of course, in a test scenario, this may waste precious time...
Reciprocal identities
The reciprocal identities follow from the definitions of the trigonometric functions.
$$\eqalign
{ \sec\theta&= {1\over \cos\theta} \qquad \tan\theta= {\sin\theta\over \cos\theta} \cr
\csc\theta&= {1\over \sin\theta} \qquad \cot\theta= {1\over \tan\theta} \cr
}
$$
Periodicity relations
The Periodicity relations follow easily by considering the
involved angles on the unit circle.
$$\def\ts{}\eqalign
{ \sin(\theta)&= \sin(\theta \pm2k\pi) \qquad \csc(\theta)= \csc(\theta \pm2k\pi) \cr
\cos(\theta)&= \cos(\theta \pm2k\pi) \qquad \sec(\theta)= \sec(\theta \pm2k\pi)\cr
\tan(\theta)&= \tan(\theta \pm k\pi)\phantom{2} \qquad \cot(\theta)= \cot(\theta \pm k \pi) \cr
}
$$
$$\eqalign
{ \sin(\theta)&= - \sin(\theta -\pi) \qquad \csc(\theta)= - \csc(\theta -\pi) \cr
\cos(\theta)&= - \cos(\theta -\pi) \qquad \sec(\theta)= - \sec(\theta -\pi) \cr
\tan(\theta)&= - \tan(\theta -\ts{\pi\over2}) \qquad \kern-3pt \cot(\theta)= - \cot(\theta -\ts{\pi\over2}) \cr
}
$$
Pythagorean Identities
The first Pythagorean Identity follows from the Pythagorean Theorem (look at the unit circle). The other two
Pythagorean Identities follow from the first by dividing both sides by the appropriate expression (divide through by $\sin$ or by $\cos$ to obtain the other two).
$$\eqalign
{ \sin^2\theta +\cos^2\theta&=1\cr
1+ \cot^2\theta& =\csc^2\theta\cr
\tan^2\theta + 1& = \sec^2\theta}
$$
Sum and difference formulas
Memorize the first sum and difference formula. The second one can be derived from the first using the fact that $\sin$ is an odd function.
One can then derive the last two sum identities by using the first two and the fact that $\cos(\theta-\pi/2)=\sin\theta$.
$$\eqalign{
\cos(x+y)&=\cos x\cos y-\sin x\sin y\cr
\cos(x-y)&=\cos x\cos y+\sin x\sin y\cr
\sin(x+y)&=\sin x\cos y+\sin y\cos x\cr
\sin(x-y)&=\sin x\cos y-\sin y\cos x\cr
}
$$
Double angle formulas
The Double Angle formulas for $\sin$ and $\cos$ are derived by using the Sum and Difference formulas by writing, for example $\cos(2\theta)=\cos(\theta+\theta)$ and using the Pythagorean Identities for the $\cos$ formula (I suppose the formula for $\tan$ should be memorized).
$$\eqalign{
\sin(2\theta)&=2\sin\theta\cos\theta \cr
\tan(2\theta)&= {2\tan \theta\over 1-\tan^2\theta } \cr
\cos(2\theta)&= \cos^2\theta-\sin^2\theta \cr
&=2\cos^2\theta -1\cr
&=1-2\sin^2\theta\cr
}
$$
Half angle formulas
The Half-Angle formulas for $\sin$ and $\cos$ are then obtained from the Double Angle formula for $\cos$ by writing, for example, $\cos\theta=\cos(2\cdot{\theta\over2})$
The $\tan$ formula here can easily be obtained from the other two.
(Note the forms for the $\cos$ and $\sin$ formulas. These aren't to hard to memorize)
$$\eqalign{
\cos{\theta\over2}&= \pm\sqrt{1+\cos\theta\over2}\cr
\sin{\theta\over2}&= \pm\sqrt{1-\cos\theta\over2}\cr
\tan{\theta\over2}&=\pm\sqrt{1-\cos\theta\over1+\cos\theta}
}$$
Best Answer
To be honest, I would always forget all my trig identities until I learned complex numbers. Assuming you don't want to go there, try to be as efficient as possible. I tell my students to remember these at the bare minimum:
$$ \cos(A\pm B) = \cos(A)\cos(B)\mp \sin(A)\sin(B)\\ \sin(A\pm B) = \sin(A)\cos(B)\pm \cos(A)\sin(B) $$
Where `$\mp$' means to flip the sign i.e. $A+B$ inside becomes $-$ outside. Then, you can get a lot of the other identities by simply adding or subtracting these! For example, the product-to-sum rule for cosine comes from adding the formulae for $\cos(A+B)$ and $\cos(A-B)$, and the product-to-sum rule for sin comes by subtracting them.
In an exam setting, you'll always be more efficient by having things memorized though, so going `from scratch' should probably be a last resort.