There are different conventions. In mathematics the usual one is to write $(-2)^2$ if you want to raise a negative number to a power, whereas $-2^2$ usually means $-(2^2)$.
This is, however, not completely universal. For example, many programming languages (that otherwise follow mathematical conventions for arithmetic expressions) consider a unary minus to bind tighter than any binary operator. In such languages, -2**2
(or whatever their syntax for exponentation is) would mean (-2)**2
.
In the end you may be better off checking both interpretations and see which of them makes sense in context. And when writing things yourself, if in doubt err on the side of too many parentheses.