If $X$ is smooth then Lefschetz' hyperplane theorem and Poincare duality yield that $H^i(X,\mathbb{Z})=H^i(\mathbb{P}^n,\mathbb{Z})$ for $i=0,\dots, 2\dim X$, $i\neq \dim X$. (This is proven in Dimca's book on topology and geometry of singular hypersurfaces. In this book there is also a proof for the fact that if $X$ is singular then $H^i(X,\mathbb{Z})=H^i(\mathbb{P}^n,\mathbb{Z})$ for $i=0,\dots, 2\dim X$, $i\neq \dim X,\dim X+1,\dots ,\dim X+\dim X_{sing}+1$ )
In the smooth case the primitive cohomology group $H^n(X,\mathbb{C})_{prim}$ can be studied by Cayley's trick: Let $c=n-\dim X$. Then Cayley's trick produces a hypersurface $Y$ in a $\mathbb{P}^{c-1}$-bundle over $\mathbb{P}^n$ such that you can represent classes in $H^n(X,\mathbb{C})$ by residues of differential forms on $\mathbb{P}^{c-1}\setminus Y$. (If $c=1$ then $X=Y$.) This is worked out in detail by several people in the 90s (one of them is Dimca, but there are also papers on this issue by other authors).
The singular case is less well understood and still subject of a present day research. Dimca's book is a nice introduction to this subject.