Let $S$ be a compact connected complex submanifold of $\mathbb{CP}^N$ (i.e. it is a smooth algberaic variety). Let $f: S \longrightarrow \mathcal{O}(1)|_S$ be a holomorphic section of the Hyperplane bundle restricted to $S$. Does $f$ extend to a holomorphic section on the whole of $\mathbb{CP}^N$, i.e. is there a globally defined holomorphic section $f: \mathbb{CP}^N \longrightarrow \mathcal{O}(1)$ whose restriction to $S$ is the given $f$?
$\textbf{Remark}:$ The above statement is not true if $S$ is not connected. For example, take $\mathbb{CP}^1$ and $S$ to be the union of the three points $[1,0], [0,1]$ and $[1,1]$. Now consider the section, induced by the homogeneous function of two variables given by $$ f(1,0) = 1, \qquad f(0,1) = 1, \qquad f(1,1) = 3. $$ This $f$ does induce a section on $S$. But since there is no homogeneous (degree one) function in two variables $f(X,Y)$ that satisfies the above conditions, there is no globally defined $f$ that restricts to the given $f$ (on $S$).
However, here $S$ is not connected.