Sofia,Sorry for the delayed response.I was busy with other posts.
you have two choices.One is to use pascals triangle and the other one is to expand using the binimial theorem.
You can compare the expression $\left ( \frac{1}{x^2} + ax \right )^6$ with $(a+x)^6$ where a = 1/x^2 and x = ax,n=6.Here'e the pascal triangle way of expanding the given expression.All you need to do is to substitute the values of a and x respectively.
$(a + x)^0 = 1$
$(a + x)^1 = a +x a+ x$
$(a + x)^2 = (a + x)(a + x) = a^2 + 2ax + x^2$
$(a + x)^3 = (a + x)^2(a + x) = a^3 + 3a^2x + 3ax^2 + x^3$
$(a + x)^4 = (a + x)^3(a + x) = a^4 + 4a^3x + 6a^2x^2 + 4ax^3 + x^4$
$(a + x)^5 = (a + x)^4(a + x) = a^5 + 5a^4x + 10a^3x^2 + 10a^2x^3 + 5ax^4 + x^5$
$(a + x)^6 = (a + x)^5(a + x) = a^6 + 6a^5x + 15a^4x^2 + 20a^3x^3 + 15a^2x^4 + 6ax^5 + x^6$
Here'e the Binomial theorem way of expanding it out.
$(1+x)^n = 1 + nx + \frac{n(n-1)}{2!}x^2 + \frac{n(n-1)(n-2)}{3!}x^3 + ...$
using the above theorem you should get
$a^6x^6 + 6a^5x^3 + 15a^4 + \frac{20a^3}{x^3} + \frac{15a^2}{x^6}+\frac{6a}{x^9}+\frac{1}{x^{12}}$
You can now substitute the constant term and get the desired answer