(Generating functions method) If $A$ is the first dice roll result and $B$ is the second, you want the number of pairs $(A,B)$ such that $A+B=n$, restricted by $A,B\in \{1,2,3,\dots,6\}$. This is (if dice ordering is important)
$$ S_n=\sum_{k=0}^6 \mathbb 1_{k} \mathbb 1_{n-k}=\sum_{k=0}^n \mathbb 1_{k} \mathbb 1_{n-k}, \quad \mathbb 1_k := \begin{cases}1 & k\in \{1,2,3,\dots,6\}, \\ 0 & \text{otherwise.}\end{cases}$$
i.e. it is the convolution product of the sequence $\mathbb 1_k$ with itself. Recall that convolution products correspond to the coefficients of the product of polynomials(or even formal power series),
$$ A(x) = \sum a_i x^i , B(x) = \sum b_i x^i \implies A(x)B(x) = \sum c_i x^i, \quad c_i =\sum_{i=0}^na_i b_{n-i}.$$
So lets consider
$P(x) = \sum_{k=0}^\infty\mathbb 1_k x^k = \sum_{k=1}^6 x^k = x + x^2 + x^3 + ... + x^6 $. Then the product
$$ P(x)^2 = \sum_{k=0}^{12} S_k x^k. $$
On the other hand,
$$P(x)^2 = \left( \sum_{k=1}^6 x^k\right)^2 = x^2 + 2 x^3+ 3 x^4+ 4 x^5 + 5 x^6 + 6 x^7 + 5 x^8+ 4 x^9+ 3 x^{10}+ 2 x^{11}+ x^{12}. $$
So computing this polynomial $P(x)^2$ computes all elements of $S_n$ at once. To get the answer for 20, just change 6 to 20 and compute the polynomial $P(x)^2 = (\sum_{k=1}^{20} x^k)^2$. This is just (I see no one else here has computed this explicitly)
$$P(x)^2 = x ^ { 40 } + 2 x ^ { 39 } + 3 x ^ { 38 } + 4 x ^ { 37 } + 5 x ^ { 36 } + 6 x ^ { 35 } + 7 x ^ { 34 } + 8 x ^ { 34 } + 8 x ^ { 33 } + 10 x ^ { 32 } + 10 x ^ { 31 } +
11 x ^ { 30 } + 12 x ^ { 29 } + 13 x ^ { 28 } + 14 x ^ { 27 } + 15 x ^ { 26 } + 16 x ^ { 25 } + 17 x ^ { 24 } + 18 x ^ { 23 } + 19 x ^ { 22 } +
20 x ^ { 21 } + 19 x ^ { 20 } + 18 x ^ { 19 } + 17 x ^ { 17 } + 16 x ^ { 17 } + 15 x ^ { 16 } + 14 x ^ { 15 } + 13 x ^ { 14 } + 12 x ^ { 13 } +
11 x ^ { 12 } + 10 x ^ { 11 } + 9 x ^ { 10 } + 7 x ^ { 9 } + 6 x ^ { 7 } + 5 x ^ { 6 } + 4 x ^ { 5 } + 3 x ^ { 4 } + 2 x ^ { 3 } + x ^ { 2 }
$$
So for instance, there are 19 ways to get a sum of 22 with 2 20-sided dice. Its easy to generalise this to any number of dice as well: if you want the number of ways to get $k$ from rolling $M$ distinct $N$-sided die, look at the $k$th coefficient in $(\sum_{1}^N x^k)^M$. This method is very robust and can solve many other counting problems, see e.g. this wikipedia page of examples, and also the incredible Generatingfunctionology book linked at the bottom of that page.