Covariant and contravariant coordinates - index notation I am learning about electrodynamics and have recently been introduced to the four vector. I also come fresh to the idea of covariant four vectors and contravariant four vectors. 
My question concerns the notation used and I would like to gain some insight into it and intuition, because it currently seems quite random and arbitrary: there doesn’t seem to be a pattern...
I have read:
$x_{\alpha} = g_{\alpha \beta} x^{\beta}$ and $x^{\alpha} = g^{\alpha \beta} x_{\beta}$ 
These give the transformation between covariant and contravariant four vectors.
Now why do we position the indices on $g$ in the same position (up/down) as the indices on $x$ on the left hand side? Is there a rule about this and if so, what is it? Do you have any more examples that can illustrate this notation (the positioning of the subscripts is what I’m interested in)? 
We also have:
$$s^2 = x_{\alpha} g^{\alpha \beta} x_{\beta} = g_{\alpha \beta} x^{\alpha} x^{\beta}.$$ 
In this case, I’m not really sure about why the position of $g$ changes... can’t we have e.g. $x^{\alpha}x^{\beta} g_{\alpha \beta}$?
 A: You should have the same kind of tensor on both sides of the equation. By 'kind', I mean the rank of a tensor, which is specified by two numbers $(m,n)$ where $m=$ number of (free, not dummy) contravariant indices and $n=$ number of covariant indices. So the metric tensor $g_{\alpha \beta}$ is a tensor of rank $(0,2)$.
The RHS of your first equation has $g_{\alpha \beta} x^{\beta}$. These are two tensors of rank $(0,2)$ and $(1,0)$ respectively. But note that $\beta$ is summed over, so that removes one contravariant rank and one covariant rank simultaneously, leaving you with $(0,1)$. So the RHS is effectively a tensor of rank $(0,1)$. The LHS has $x_\alpha$, which is exactly the rank you need.
You can also think about the action of a metric tensor as a map. A metric tensor g is a map from $2$ vectors (that is, contravariant $(1,0)$ tensors) to a scalar (I'm using bolded notation to signify the tensor itself, and not its components). If you input just one vector, like in your first equation, you get a new tensor which is, say, z. If we now input another vector to this z, we get a scalar. So z is a tensor that takes in $1$ vector and outputs a scalar $\Rightarrow$ It's a one-form, or a $(0,1)$ rank tensor. This is your LHS.
So you should be able to see that:
$$s^2 = g^{\alpha \beta} x_\alpha x_\beta = g_{\alpha \beta} x^\alpha x^\beta = g_\alpha^{\ \beta} x^\alpha x_\beta = g^\alpha_{\ \beta} x_\alpha x^\beta$$
A: The position of the indices contains real information about how a vector or tensor transforms under a change of coordinates (node: coordinates are themselves not vectors). For two things to be equal, they have to be equal in all coordinate systems. This means that the uncontracted indices (i.e. the ones that are not summed over) must always stay the same on both sides of the equality. 
As for your formula for $s^2$, it is of course valid. Order is not important using index notation, since each value $x^\alpha$ is just a number. You could also write $s^2 = x_\alpha g^\alpha_{~~~\beta} x^\beta = x^\alpha x_\alpha$.
