Do the grouping $x+x^{2}-xy^{2}-y^{2}=\left(x+x^{2}\right)+\left(-xy^{2}-y^{2}\right)$, and factor out $x$ in the first and $-y^{2}$ in the second group.
$$x\left(x+1\right)-y^{2}\left(x+1\right)$$
Factor out common term $x+1$ by using distributive property.