Speaking in (incredibly) general terms, the problem you have just described is that of finding the "normal" form of a term.
In the study of formal systems, equivalent terms usually have several different representations. For example, if we're working with polynomials, x^2 + 1 + 2x is equal to 2x + x^2 + 1, even though how they are written on paper ("exs squared plus one... etc" versus "two exs plus ... etc") are different.
So if you have two terms, how can you tell if they are equal if they can be written out different? One practical example of this would be: If you were a math teacher and the answer your student gave you was different from your answer key, how could you tell if their answer was incorrect? Your answer key may say the answer is "x^2 + 2x + 1", but the student put "1 + 2x + x^2". Obviously these terms are different, yet they are "equal" inside the system we're working with.
The answer is you convert them to normal formal. The definition on "normal form" differs from system to system. For polynomials, we usually use the following definition:
A polynomial is in normal form when it is written c_nx^n + c_{n-1}x^{n-1} + c_{n-2}x^{n-2} + \cdots + c_1x + c_0 for some (constant) integers c_0, c_1, c_2, \cdots, c_n and (constant) integer n.
Some systems do not have normal forms. This was one of the big discoveries in the early 20th Century. For example, if instead of polynomials (a kind of mathematical object), we used computer programs in some programming language (another kind of mathematical object), we would find there is no useful way to put a program in any sort of "normal" form. The major consequence of this is that it's impossible to mechanically decide whether two programs are equal to each other. (To show two programs are equal, you need look for a custom proof -- it's effectively a very difficult guessing game to show two arbitrary computer programs are equal).
In your particular case, you're working with algebraic expressions. There are no hard-and-fast definitions for what constitutes a normal form (I wouldn't imagine there is one at all). However, there are lots of loose conventions. Generally, you keep integral constants on the far left. Variables on the right. But in the case of the radical, those rules can be bent to avoid confusion (since some people are sloppy with the "bar" of the radical). The two primary concerns are readability and ease of manipulation. If you can achieve those, it really doesn't matter how you write them.