Suppose $X$ is a variety where every line bundle is the line bundle associated to a divisor. (In particular, one way this happens is if $X$ is noetherian and factorial, for instance $X$ smooth). I claim that if $s_0,\cdots,s_d$ are global sections of $\mathcal{O}_X(D)$ which generate $\mathcal{O}_X(D)$ at every point, then the map $\varphi:X\to\Bbb P^l$ by $x\mapsto [s_0(x):\cdots:s_d(x)]$ satisfies $\varphi^*\mathcal{O}_{\Bbb P^l}(1)\cong\mathcal{O}_X(D)$.
As $i^*\mathcal{O}_{\Bbb P^l}(1)$ is a line bundle on $X$, it must be the line bundle associated to some divisor $D'$. So what's $D'$? Well, if we take some global section of $\mathcal{O}_{\Bbb P^l}(1)$ not vanishing identically on $\varphi(X)$, then we get a global section of the pullback which cuts out $D'$. But this global section is also a global section of $\mathcal{O}(D)$, and since any nonzero global section of the line bundle associated to a divisor cuts out a divisor linearly equivalent to that divisor, we must have that $D\sim D'$ and therefore $\mathcal{O}_X(D)\cong\mathcal{O}_X(D')$.
How does this apply to your situation? Well, $D=K$, so $\varphi_K^*\mathcal{O}(1)\cong \mathcal{O}_X(K)$, which has $\dim H^0(\mathcal{O}_X(K))=3$ by Riemann-Roch.