Step 1: Look at the orders of the numerator and the denominator. For instance, in the second example, the order of the numerator is 4 ($x^4$ is the largest power) and the order of the denominator is 3 ($x\cdot x^2=x^3$ is the largest power). If $n\geq m$, where $n$ is the order of the numerator and $m$ is the order of the denominator, then you need to add linear terms up to order $n-m$. In this case, up to order $1$, so you have
$$
Ax+B+\frac??+\frac??
$$
Step 2: Separate out the factors in the denominator into separate fractions. So in your question case, you have
$$
\frac{2ax}{(x-2a)(x^2+a^2)} = \frac?{x-2a}+\frac?{x^2+a^2}
$$
Step 3: Give each numerator powers up to, but not including the order of the denominator. So the denominator of the first fraction is order 1, so you have up to order 0, meaning just a constant, $A$. The denominator of the second fraction is order 2, so you have up to order 1, so it's $Bx+C$, giving
$$
\frac{2ax}{(x-2a)(x^2+a^2)} = \frac{A}{x-2a}+\frac{Bx+C}{x^2+a^2}
$$
If a denominator had a cubic, order 3, then the numerator would be up to order 2, so $Ax^2+Bx+C$.
EDIT: Note that you may include a fourth step if you have a repeated factor. If you have $(x-a)^2$ as a factor of the denominator, then you could write
$$
\frac{Ax+B}{(x-a)^2}
$$
But you could also write it as
$$
\frac{A}{x-a}+\frac{B}{(x-a)^2}
$$
which is equivalent for different values of $A$ and $B$. It is often viewed as better to use the latter expression.