Why does the angle of waves change in refraction instead of just altering the relative position of each component the medium? So, first of I would like to apologize if my question is at all stupid, I am not at all good at physics, but I do quite enjoy studying and learning about it.
So I know about refraction, I'm aware of Snell's law (though I don't understand how it was derived), and I have heard the ever-popular soldiers marching until they meet a hill analogy. The issue I have with this analogy is that when the soldiers, representing molecules or particles, are put out of alignment due to some of them being slowed down before others, they compensate by changing the angle that they are going. With soldiers fine, because soldiers have a brain and can make a conscious choice to change direction to stay in alignment, but molecules don't have brains to make that change in direction. I guess what I am trying to ask, is why do particles change direction instead of just slowing and falling out of sink with each other?
 A: I prefer to understand this question in terms of the electric fields. Basically, Snell's law falls out of forcing phase matching at the interface.
First of all, when you talk of a light ray, I'll take that to mean a plane wave of a specific frequency and direction. Consider the problem of a plane wave approaching an interface at $x=0$ from the $-x$ half-space, so traveling generally in the $+x$ direction, but at an angle $\theta_1$ from
normal. The left half-space, $x<0$ contains a material of refractive index $n_1$, and the right half-space contains a material of refractive index $n_2$. We'll assume that the electric field is polarized in the $z$-direction, and only consider the $z$-component of the electric field. This electric field can be given by
$E_1(x,y,t) = \cos(k_1 x \cos(\theta_1) + k_1 y \sin(\theta_1) - \omega t) \hspace{1cm} x \lt 0$
where $\omega = 2\pi f$ is the radial frequency, $k_1 = \frac{\omega n_1}{c}$ is the propagation constant in that medium, and $c$ is the speed of light.
In the right half-space, $x>0$, the transmitted wave will look like 
$E_2(x,y,t) = A \cos(k_2 x \cos(\theta_2) + k_2 y \sin(\theta_2) - \omega t + \phi) \hspace{1cm} x\gt 0$
where $k_2 = \frac{\omega n_2}{c}$ and and $\theta_2$ is the unknown transmitted angle. $A$ is an as-yet-unknown magnitude, $\phi$ is some unknown phase offset. $A$ and $\phi$ are only included to be complete, as we will quickly find that $A=1$ and $\phi=0$.
One of the first things you learn in introductory electromagnetics is that the tangential component of the electric field must be continuous everywhere, even across material discontinuities. (Unless there's some kind of source, which we're assuming there's not.) The z-component of $\mathbf{E}$ is clearly tangential to the interface. That means that we must find that 
$E_1(x,y,t)|_{x=0} = E_2(x,y,t)|_{x=0}$
$\cos(k_1 y \sin(\theta_1) - \omega t) = A \cos(k_2 y \sin(\theta_2) - \omega t + \phi)$
It should be apparent that the left and right side of this equation can only be equal for all $y$ and $t$ if $A=1$, $\phi=0$, and 
$k_1 \sin(\theta_1) = k_2 \sin(\theta_2)$
$\frac{\omega n_1}{c} \sin(\theta_1) = \frac{\omega n_2}{c} \sin(\theta_2)$
$n_1 \sin(\theta_1) = n_2 \sin(\theta_2)$

This figure shows a graphical depiction when $n_1 < n_2$. Note that the fields match at $x=0$.

