This may give you more of the theory or logic that you want behind this (I give an explanation of your example specifically at the end), although Marco does provide a nice, intuitive combinatorial analysis.
As someone pointed out, $\sigma$ is the sum of divisors function, which is defined by setting $\sigma(n)$ equal to the sum of all the positive divisors of $n$.
Now, we have that $\tau$ is the number of divisors function, which is defined by setting $\tau(n)$ equal to the number of positive divisors of $n$.
First note that $\sigma(n)$ and $\tau(n)$ may be expressed in summation notation:
$$
\sigma(n)=\sum_{d\mid n}d\quad\text{and}\quad \tau(n)=\sum_{d\mid n}1.
$$
I am going to assume that you know $\sigma(n)$ and $\tau(n)$ are multiplicative functions (if not, proofs of this fact are easy to find); that is,
$$
\sigma(mn)=\sigma(m)\sigma(n)\quad\text{and}\quad\tau(mn)=\tau(m)\tau(n),\tag{1}
$$
where $m$ and $n$ are relatively prime positive integers (such functions are called completely multiplicative if $(1)$ holds for all positive integers $m$ and $n$).
With that out of the way, we can develop what you learned more rigorously by starting out with a lemma, then a theorem, and then a simple example.
Lemma: Let $p$ be prime and $a$ a positive integer. Then
$$
\sigma(p^a)=1+p+p^2+\cdots+p^a=\frac{p^{a+1}-1}{p-1},\tag{2}
$$
and
$$
\tau(p^a)=a+1.\tag{3}
$$
Proof. The divisors of $p^a$ are $1,p,p^2,\ldots,p^{a-1},p^a$. Hence, $p^a$ has exactly $a+1$ divisors, so that $\tau(p^a)=a+1$. Also, we note that $\sigma(p^a)=1+p+p^2+\cdots+p^{a-1}+p^{a}=\frac{p^{a+1}-1}{p-1}$ (the sum of terms in a geometric progression).
Theorem: Let the positive integer $n$ have prime factorization $n=p_1^{a_1}p_2^{a_2}\cdots p_s^{a_s}$. Then we have that
$$
\sigma(n)=\frac{p_1^{a_1+1}-1}{p_1-1}\cdot\frac{p_2^{a_2+1}-1}{p_2-1}\cdot\cdots\cdot\frac{p_s^{a_s+1}-1}{p_s-1}=\prod_{j=1}^s\frac{p_j^{a_j+1}-1}{p_j-1},\tag{4}
$$
and
$$
\tau(n)=(a_1+1)(a_2+1)\cdots(a_s+1)=\prod_{j=1}^s(a_j+1).\tag{5}
$$
Proof. Since $\sigma$ and $\tau$ are both multiplicative, we can see that
$$
\sigma(n)=\sigma(p_1^{a_1}p_2^{a_2}\cdots p_s^{a_s})=\sigma(p_1^{a_1})\sigma(p_2^{a_2})\cdots\sigma(p_s^{a_s}),
$$
and
$$
\tau(n)=\tau(p_1^{a_1}p_2^{a_2}\cdots p_s^{a_s})=\tau(p_1^{a_1})\tau(p_2^{a_2})\cdots\tau(p_s^{a_s}).
$$
Inserting the values for $\sigma(p_i^{a_i})$ and $\tau(p_i^{a_i})$ found in $(2)$ and $(3)$, we obtain the desired formulas.
Example: Calculate $\sigma(200)$ and $\tau(200)$.
Solution. Using $(4)$ and $(5)$, we have that
$$
\sigma(200)=\sigma(2^35^2)=\frac{2^4-1}{2-1}\cdot\frac{5^3-1}{5-1}=15\cdot 31=465,
$$
and
$$
\tau(200)=\tau(2^35^2)=(3+1)(2+1)=12.
$$
For your observation specifically, calculating $\sigma(12)$ and $\tau(12)$ yields the following:
- $\displaystyle \sigma(12)=\sigma(2^23^1)=\frac{2^3-1}{2-1}\cdot\frac{3^2-1}{3-1}=7\cdot 4=28$.
- $\tau(12)=\tau(2^23^1)=(2+1)(1+1)=3\cdot 2 = 6$.