In how many different from a set of numbers can a fixed sum be achieved?
This is a classic problem for generating functions. Represent the number of ways to represent $n$ as the coefficient of $n$ in a formal power series. If you just had $1$ available, there would be one way to represent each number and the generating function would be $1+x+x^2+x^3+\ldots,$ which we can formally sum to $\frac 1{1-x}$. Similarly if you just had $2$ available you could only represent even numbers and the series would be $1+x^2+x^4+\ldots=\frac 1{1-x^2}$ If you have both $1$s and $2$s available, you multiply them, so the number of ways to write $10$ is the coefficient of $x^{10}$ in the series for $\frac 1{(1-x)(1-x^2)}$, which is $6$ per Alpha When you have only two addends it is much easier because you can choose the number of twos in $6$ ways, from $0$ to $5$, then fill with ones.
We can use generating functions.
Take your example of writing n as a sum of $1$s and $2$s, represent the number of possible $1$s as
$$x^{0\cdot 1}+x^{1\cdot 1}+x^{2\cdot 1}+x^{3\cdot 1}+\cdots$$
What is $x$? You might ask, well it isn't anything, it has no value beyond the formality of allowing us to write out a list of possible $1$s in our sum. E.g. $x^{3\cdot 1}$ denotes the possibility of a sum having three $1$s.
We can do the same with the number of possible $2$s by listing
$$x^{0\cdot 2}+x^{1\cdot 2}+x^{2\cdot 2}+x^{3\cdot 2}+\cdots$$
Now since we are interested in all combinations of $1$ and $2$ added, if we multiply these two lists as if they were series then each resulting term will represent a possible sum, this is called a generating function
$$(x^{0\cdot 1}+x^{1\cdot 1}+x^{2\cdot 1}+x^{3\cdot 1}+\cdots)(x^{0\cdot 2}+x^{1\cdot 2}+x^{2\cdot 2}+x^{3\cdot 2}+\cdots)\tag{1}$$
So the expansion will have terms like your first example $x^{2\cdot 1+4\cdot 2}=x^{10}$ and the coefficient in front of this term will be the number of times the sum of $10$ can be achieved using $1$s and $2$s.
We are able to use the expansion $(1-u)^{-1}=1+u+u^2+u^3+\cdots$ and the difference between two squares $a^2-b^2=(a-b)(a+b)$ to help us express the product $(1)$ as
$$\frac{1}{(1-x)(1-x^2)}=\frac{1}{(1-x)^2(1+x)}\tag{2}$$
which can be written using partial fractions
$$\begin{align}\frac{1}{(1-x)^2(1+x)}&=\frac{1}{2(1-x)^2}-\frac{1}{4(1-x)}+\frac{1}{4(1+x)}\\[1ex] &=\frac{1}{2}\sum_{n\ge 0}\binom{n+1}{1}x^n - \frac{1}{4}\sum_{n\ge 0}x^n+\frac{1}{4}\sum_{n\ge 0}(-1)^nx^n\\[1ex] &=\sum_{n\ge 0}\frac{2(n+1)+1+(-1)^n}{4}x^n\end{align}$$
Hence in the simple case of $1$s and $2$s we can derive a formula
$$\text{required count using $1$s and $2$s}=\frac{2(n+1)+1+(-1)^n}{4}$$
So for example for a sum of $n=10$ there are $(2\cdot 11+1+1)/4=24/4=6$ possible sums.
It is possible to derive formulas for larger sets of possible parts (not just parts of size $1$ and $2$) but the maths becomes more long-winded. In general it is better to use the series products like $(1)$ to derive a $2$ dimensional recurrence (a bit like Pascal's Triangle) to calculate relevant coefficients.
An example of the generating function for sums involving $1$s, $2$s and $3$s is
$$\dfrac{1}{(1-x)(1-x^2)(1-x^3)}$$
derived in the same way as for your example.