Sections of the canonical bundle of a blow-up Let $X^n$ be a complex manifold and $\sigma:\hat{X} \to X$ the blow-up at a point $x \in X$ and $E = \sigma^{-1}(x)$ the exceptional divisor.
It is known that the canonical bundle of $\hat{X}$ is given by $K_{\hat{X}} = \sigma^*K_X\otimes \mathcal{O}((n-1)E)$. I am trying to understand why $H^0(\hat{X},K_{\hat{X}}) \simeq H^0(X,K_X)$.
Because $\sigma$ is an isomorphism away from $E$, the pullback gives an isomorphism $H^0(\hat{X}\setminus E,K_{\hat{X}}) \simeq H^0(X \setminus \lbrace x \rbrace,\sigma^* K_X)$ and by Hartog's theorem it extends to $X$.
What I couldn't see is why we can extend this to $\hat{X}$ adding the term $\mathcal{O}((n-1)E)$. Using the fact that $\mathcal{O}(E)$ is trivial on $\hat{X} \setminus E$ we get $H^0(\hat{X}\setminus E,K_{\hat{X}}) \simeq H^0(\hat{X}\setminus E,K_{\hat{X}} \otimes \mathcal{O}((n-1)E)$, but I couldn't go further.
 A: Use exact sequences
$$
0 \to \sigma^*K_X \to \sigma^*K_X(E) \to \sigma^*K_X(E)_{|E} \to 0,
$$
$$
0 \to \sigma^*K_X(E) \to \sigma^*K_X(2E) \to \sigma^*K_X(2E)_{|E} \to 0,
$$
$\dots$
$$
0 \to \sigma^*K_X((n-2)E) \to \sigma^*K_X((n-1)E) \to \sigma^*K_X((n-1)E)_{|E} \to 0,
$$
and the fact that all line bundles
$$
O(E)_{|E} = O_E(-1), O(2E)_{|E} = O_E(-2), \dots, O((n-1)E)_{|E} = O_E(1-n)
$$
on $E = P^{n-1}$ are acyclic. 
A: Here's how I tend to think about this:  you want to show that $$\sigma_* \mathcal{O}_{\hat{X}}( (n-1) E + \sigma^* K_X) = \mathcal{O}_{X}(K_X).$$
This is actually more than you need.
So, by the projection formula and as you mentioned, that $K_{\hat{X}} = \sigma^*K_X\otimes \mathcal{O}((n-1)E)$, we only have to show that
$$\sigma_* O_{\hat{X}}( (n-1) E ) = {O}_{X}.$$
The left side is rational functions which are regular on $X \setminus \{ x \}$, where $\sigma$ is an isomorphism, and which have poles of order at most $n-1$ at $E$.  
Certainly we have the containment $\supseteq$ (functions that are regular on $X$ are regular on $\hat{X}$ also).  
On the other hand set $U$ to be $X$ with the point $x$ removed.  If $i : U \to X$ is the inclusion, then $i_* \mathcal{O}_{U}$ is all rational functions on $X$ that are regular except at $x \in X$.   Certainly then
$$O_X \subseteq \sigma_* O_{\hat{X}}( (n-1) E ) \subseteq i_* \mathcal{O}_U.$$
As you pointed out, by Hartog's theorem this composition is an isomorphism.  Thus you get the statement you wanted as well.
A: Lemma Let $\phi:Y\to X$ be a proper birational morphism of complex manifolds of dimension at least $2$. Let $E\subset Y$ be the exceptional locus of $\phi$. Note that $E$ is a Cartier divisor. Then for any $a>0$,
$$\phi_*\mathscr O_E(aE)=0.$$
Remark Actually the statement is true for more general $\phi$, but this will do for now.
Proof (Sketch) We prove this by induction. If $\dim X=2$, then $E^2<0$, so $\mathscr O_E(aE)$ has no global sections and the statement follows. If $\dim X>2$, then we first take  hyperplane sections on $X$ until $\phi(E)$ is zero-dimensional and then take hyperplane sections on $Y$. In both cases it is relatively easy to prove that the induction hypothesis implies the desired statement (I will try to add this later when I will have more time). Q.E.D.
Corollary Under the same assumptions as above,
$$\mathscr O_X\simeq \phi_*\mathscr O_Y(aE).$$
Proof Apply $\phi_*$ to the short exact sequence $$0\to \mathscr O_Y((a-1)E) \to \mathscr O_Y(aE) \to \mathscr O_E(aE) \to 0.$$
Q.E.D.
Now as $X$ is smooth, we have $$K_Y\sim \phi^*K_X + aE$$ for some $a> 0$. Then by the projection formula
$$\phi_*\mathscr O_Y(K_Y)\simeq \mathscr O_K(K_X)\otimes \phi_*\mathscr O_Y(aE)\simeq \mathscr O_X(K_X).$$
By the definition of $\phi_*$ the statement follows.
Remark this is actually true under more general circumstances.

I've just noticed that I have not addressed your last question about why you need $(n-1)E$ added. One way to see this is by explicit calculation. Write down a differential form and the blow up in local coordinates and you see that when you pull it back the differential form picks up some poles, in fact, $(n-1)$ times $E$ poles.
Another way to compute this is to use adjunction: $$\mathscr O_Y(K_Y+E)|_E=\mathscr O_E(K_E)= \mathscr O_E(-n)$$ (since $E\simeq \mathbb P^{n-1}.$) 
At the same time, you know that the normal bundle of $E$ is $\mathscr O_E(-1)$ which is equivalent to saying that $\mathscr O_E(E)\simeq \mathscr O_E(-1)$. Combining these and the fact that the pull back of a line bundle restricted to a fiber is always trivial gives you what you want.
A: Since the computation is essentially the same, let's do it in the $2$-dimensional case. So let us  assume first $X=\mathbb{A}^2$ with coordinates $x, y$. We have 
$\tilde{X}=\{\lambda x+ \mu y=0\} \subset \mathbb{A}^2 \times  \mathbb{P}^1$.
In the affine chart $\mu=1$ the equation is therefore $y=\lambda x$, and the exceptional divisor $E$ is given by $x=0$.
Now let $\omega$ be a meromorphic $2$-form on $X$, that we can write as
$\omega=\frac{f(x,y)}{g(x,y)}dx \wedge dy$.
Therefore
$\sigma^* \omega=\frac{f(x, \lambda x)}{g(x, \lambda x)} dx \wedge d(\lambda x)= x \frac{f(x, \lambda x)}{g(x, \lambda x)} dx \wedge d \lambda$.
Therefore in a neighborhood of $E$ we have
$\textrm{div} \ (\sigma^* \omega)= \sigma^* (\textrm{div} \ \omega) + E$.
Since clearly $\textrm{div} \ (\sigma^* \omega)= \sigma^* (\textrm{div} \ \omega)$ outside $E$, it follows in particular that the divisor of every holomorphic form on $\tilde{X}$ contains the component $x=0$, i.e. the exceptional divisor. 
Now take $X$ projective. The previous local computation shows that the
exceptional divisor is contained in the fixed part of the canonical system of $\tilde{X}$, namely
$|K_{\tilde{X}}|= E + |K_X|$
(if you prefer, this also follows from $K_{\tilde{X}} E=-1$).
This implies
$H^0(\tilde{X}, K_{\tilde{X}})=H^0(\sigma^* K_X)=H^0(K_X)$,
the second equality following from the fact that $\sigma$ has degree $1$.
