In general, there is a bijection $$\Phi \colon [S^{k-1}, \textrm{GL}_n^+(\mathbb{R})] \to \textrm{Vect}_+^n(S^k),$$ where $[X,Y ]$ denotes the set of homotopy classes of continous maps from $X$ to $Y$ and $\textrm{Vect}_+^n(Z)$ denotes the set of isomorphism classes of real (oriented) vector bundles of rank $n$ on $Z$.
Using the retraction of $\textrm{GL}_n^+(\mathbb{R})$ onto $\textrm{SO}(n)$ one obtains another bijection $$\Psi \colon [S^{k-1}, \textrm{SO}(n)] \to \textrm{Vect}_+^n(S^k).$$
In the case of line bundles we have $n=1$ and $\textrm{SO}(1)$ is just a point, hence the bijection $\Psi$ shows that any orientable real line bundle on $S^k$ is trivial. Furthermore, it is not difficult to prove that when $k \geq 2$ any real vector bundle on $S^k$ is orientable, so any real line bundle is trivial.
Notice that this is not true for $S^1$, where there is an orientable bundle (the trivial one) and a nonorientable one (the Moebius band).
Similar methods of classification can be applied to the case of complex vector bundles in order to show that $S^2$ admits nontrivial complex line bundles.
In fact, one finds that there is a bijection $$\Phi_{\mathbb{C}} \colon [S^{k-1}, \textrm{GL}_n(\mathbb{C})] \to \textrm{Vect}_{\mathbb{C}}^n(S^k).$$ For $n=1$, moreover, there is a bijection between $[S^{k-1}, \textrm{GL}_1(\mathbb{C})]$ and $H^2(S^k, \mathbb{Z})$. In particular, if $k \neq 2$ the only complex line bundle on $S^k$ is the trivial one, whereas if $k =2$ there is a discrete family $\{L_t \}$ of non-isomorphic complex line bundles, parametrized by $t \in \mathbb{Z}$. In fact, viewing $S^2$ as the Riemann sphere with complex coordinate $z$, the transiction function of $L_t$ is $z^t$.
For further details you can look at Hatcher's book Vector bundles and K-theoryVector bundles and K-theory, Chapter 1.