I think the OP has indicated that his question is not operator precedence, nor programming languages, but the actual math. So let me try this.
If we restrict ourselves to positive integer exponents, then the definition of x ^ i (where normally that would be written as x with superscript i) is: "1 * x * x * x * ... * x * x", with the x repeated i times. Special cases include x ^ 1 (which is just "x" written once), and x ^ 0 (which is just 1, because I explicitly included the "1 *" in the above expression to be clear). So far, so good?
Now, with negative numbers, this works exactly the same, except that we now have to be careful about where to place the brackets. Everyone agrees that (-5) * (-5) = 25, because the minus signs cancel, right? Therefore (-5) ^ 2 is also 25.
By the way, from this we can derive a fun fact: A negative number, when taken to an even power, will be positive. When taken to an odd power, it will be negative. The proof is left to the student. Along the same lines, we can extend the above notation to the case of negative exponents, if we define x^(-i) to be "1 / (x * x * x * ... * x * x)", with i instances of x.
The confusion that most posters have been trying to address is that the expression "-5^2" can be ambiguous, it can be interpreted as (-5) ^ 2 or as -( 5^ 2). To fix this ambiguity, one would need operator precedence rules. For example, everyone knows that multiplication has higher precedence than addition. So the expression "1*2+3*4" needs to be interpreted as " (1*2) + (3*4)", which makes 14. There are many other ways one could interpret it, for example left to right as "((1*2) + 3) *4", which makes 20. There are zillions of other ways to interpret that expression. The important part is that programming languages have strict rules for operator precedence. Mathematics also has them. But in practice, one should not rely on the obscure part of rules (for example whether unary - is different from operator -), but use brackets generously to make things clear. Or to say it different: writing "-5^2" is a bad idea, because it requires the reader to think, and that's hard. Either write "(-5)^2" or "-(5^2)" to be clearer. If there is any chance that the reader could be confused, add brackets. This is like the old joke about punctuation saves lives: there is a difference between "let's eat grandma", and "let's eat, grandma".