It's a counting problem. It is based on the following:
Product Rule: If one even can occur in $k$ different ways, and a second event can occur in $m$ different ways, then the number of ways in which both events can occur is $km$.
That is, there are $k$ possible outcomes for the first event, and $m$ for the second, so there are $km$ total possible combinations of outcomes.
The truth table has one row for every possibility. Each variable has two possible outcomes: true or false. If there are $n$ different variables, then you have two possibilities for each, and the number of total combinations is the product of the number of possible outcomes for each. That amounts to a product of $2$ with itself, $n$ times, or $2^n$.
Inductively: one variable has $2$ possible outcomes. Assume that $k$ variables have $2^k$ possible outcomes. How many possible outcomes are there for $k+1$ variables? There are $2^k$ ways in which you can have outcomes in which the last variable is false, and another $2^k$ ways in which you can have outcomes in which the last variable is true. So there is a total of $2^k+2^k = 2(2^k) = 2^{k+1}$ different possible outcomes.