Let $Z = \mathrm{Proj}\,k[x_{0},x_{1},\ldots,x_{r}]/f$ be a closed subscheme of degree $d$, i.e., $f$ is a homogeneous polynomial of degree $d$, and $\mathcal{O}_{Z}(1)=i^{*}\mathcal{O}_\mathbb{P}(1)$. Could someone please help me compute all the cohomology groups? I took the short exact sequencence given by the surjection from the closed immersion, but im not sure how twisting and taking long exact sequence will solve it!

If you are just looking for cohomology of the structure sheaf (or of the twists $\mathcal{O}_X(n)$), then it should be pretty easy. You have the following short exact sequence. $$0 \to O_{\mathbb P} (d + n) \to O_{\mathbb P}(n) \to O_Z(n) \to 0 $$ Take cohomology. Because $\mathbb{P}$ is projective space (of whatever dimension) almost all of the cohomology groups $H^i(P, \mathcal{O}_{\mathbb{P}}(k))$ vanish. Whatever doesn't vanish is relevant to computing the cohomology of $\mathcal{O}_Z(n)$. For example, the only two relevant parts of the sequence are: $$0 \to H^0(\mathbb{P}, O_{\mathbb P} (d + n)) \to H^0(\mathbb{P}, O_{\mathbb P}(n)) \to H^0(Z, O_Z(n)) \to 0.$$ and $$0 \to H^{\dim Z}(Z, O_Z(n)) \to H^{\dim Z + 1}(\mathbb{P}, O_{\mathbb P} (d + n)) \to H^{\dim Z + 1}(\mathbb{P}, O_{\mathbb P}(n)) \to 0.$$ So for example, the dimension of $H^{\dim Z}(Z, O_Z(n))$ is the same as the dimension of $H^{\dim Z + 1}(\mathbb{P}, O_{\mathbb P} (d + n))$ minus the dimension of $H^{\dim Z + 1}(\mathbb{P}, O_{\mathbb P} (n))$. See Chapter III, Section 5 of Hartshorne for example. For a generalization to complete intersections, see Exercise 5.5 in that same section of Hartshorne. Of course, if you trying to compute the cohomology of some other sheaves, then it will be much much harder and it will depend on the sheaves as Emerton above suggests. 

