I'm a computer science student, I'm not a mathematician, I don't know anything about number or group theory.

I'm looking at RSA, and I want to understand it.
I know what Fermats's little theorem and Euler's totient function are, and this is what I've got:

* $p, q$ primes, $n=pq$.
* $d$ relatively prime to of $\varphi(n)=(p-1)(q-1)$.
* $e$ so that $ed \pmod{\varphi(n)}= 1$.
* Hence $x^{ed} \pmod{n} = x$.

For encryption I have to use $c=w^e \pmod n$, and for decryption $w=c^d \pmod n$. But I don't understand what has happened beyond, and how those formulas are linked.