How can hypersurfaces "know" the degree of their defining polynomials?

Solution 1:

You are absolutely right: those definitions in the book are rather sloppy!
If you have a homogeneous polynomial $F(X_0,\dots,X_n)$ of degree $d$ you should decompose it into irreducible factors as $F=F_1^{m_1}\dots F_r^{m_r}$ and associate to this decomposition the so-called divisor $$V(F)=m_1V(F_1)+\dots+m_rV(F_r)$$

The sets $V(F_i)$ are called the irreducible components of the divisor $V(F)$ and the set $V_{red}(F)=V(F_1)\cup\dots \cup V(F_r)$ is called the support of the divisor $V(F)$.
The degree of the divisor $V(F)$ is of course the degree of $F$ and $$\operatorname {deg} F=\sum m_i \operatorname {deg} F_i$$
Contrary to what one might naïvely think it is not a good idea to replace $F$ by the product without multiplicities $F_{red}=F_1\dots F_r$.
The reason is that if you consider a family of irreducible polynomials like, say, $$F_t(X_0,\dots,X_n)=X_0^2+t(X^2_1\dots+X_n^2)$$ you want the limit of the $V(F_t)$'s for $t$ tending to zero (strangely, this makes sense!) to be $V(F_0(X_0,\dots,X_n))=V(X^2_0)$ and not $V(X_0)$, in order to obtain a flat pencil of divisors , flatness being a very useful more advanced concept.

Conclusion
As you very aptly say we must consider hypersurfaces which know the multiplicities in the polynomials which define them: the divisor concept is the key to that knowledge.
In his much more elementary, freely available, online book Algebraic Curves Fulton defines, at the very beginning of chapter 3, a curve exactly in this way: as a divisor.
[As to canonical bundles, I would advise you to only consider them in the case of an irreducible smooth hypersurface $V(F)$ ($F$ irreducible ) ]

Solution 2:

Here is a topological way of recovering the degree. If $V \subset \mathbb{CP}^n$ is a (smooth) hypersurface, then by the Lefschetz hyperplane theorem the map

$$H^2(\mathbb{CP}^n, \mathbb{Z}) \to H^2(V, \mathbb{Z})$$

is injective. The LHS has a distinguished element $\omega$ given by the Chern class of $\mathcal{O}(1)$, and hence so does the RHS.

Now, the normal bundle to $V$ in $\mathbb{CP}^n$ is a complex line bundle on $V$, and so it also has a Chern class. If $V$ is a hypersurface of degree $d$ then in fact the normal bundle to $V$ is $\mathcal{O}(d) \mid_V$, and so its Chern class is $d \omega$.

So we find that we can recover the degree using only 1) the Chern class of $\mathcal{O}(1)$ in $H^2(\mathbb{CP}^n, \mathbb{Z})$ and 2) the almost complex structure on the normal bundle to $V$.