Suppose $K\subset \mathbb{C}^n$ is a compact subset and $f:\mathbb{C}^n\setminus K\to \mathbb{C}$ is a holomorphic function. Then, provided $n>1$, $f$ extends to a holomorphic function defined on the whole $\mathbb{C}^n$. This is the Hartogs' extension theorem, and a proof can be found e.g. somewhere in the very beginning of Griffiths-Harris.


This theorem is still true if one replaces $\mathbb{C}^n$ by a connected open subset $U$ of $\mathbb{C}^n$ (upd: and takes $K$ to be a compact subset of $U$ that does not disconnect it, or else there may be a problem even with a locally constant function), see e.g. theorem 2 in <http://www.encyclopediaofmath.org/index.php/Hartogs_theorem>


I would like to ask if this theorem can be generalized to other complex manifolds (e.g., to Stein manifolds). If there is an answer in the algebraic case, that would be particularly interesting.



Extending holomorphic functions
Yes, there are several generalizations of Hartogs Extension Theorem that hold on Stein spaces.


For a good survey you can look at the paper by Øvrelid and Vassiliadou [Hartogs Extension Theorems on Stein Spaces](http://link.springer.com/article/10.1007/s12220-010-9134-3), *Journal of Geometric Analysis* **20** (2010), 817-836. 


Let me just recall Theorem 1.2 of that article, which is due to Rossi (*Annals of Mathematics* **78** (1963), 455–467).



> 
> **Theorem.** Let $X$ be a connected, normal Stein space of dimension $\geq 2$. Let $K$ be a compact subset of $X$ and let $h$ be a holomorphic function on $X \setminus K$. Then there is a unique holomorphic function $H$ on $X$ such that $H=h$ on the unbounded component of $X \setminus K$.
> 
> 
> 


