I have seen at least two ways to define flops (and similarly flips). We start with $Y \to X$, a surjective birational morphism, contracting a locus of codimension at least 2, such that $K_Y$ is relatively trivial.

1) We start with $\pi\colon Y \to X$ and take Proj(\oplus \pi_*O(mH)) for $H$ relatively ample or anti-ample.

2) It is the unique $W \to X$ satisfying the same assumptions as $Y \to X$ but such that $W$ is not isomorphic to $Y$.

Why are these two definitions equivalent? (for flips one has instead $K_Y$ is relatively anti-ample and $K_W$ ample)

There is also a special class of flops, sometimes called standard.

3) Let $C$ be a $(-1,-1)$ curve in $Y$. Blow it up. The exceptional locus is $P^1 \times P^1$. Contract in the other direction and obtain $W$.

Why is this equivalent to other two definitions?

EDIT: I've edited the question following SK's answer. I guess what I really would like to understand is the line in SK's answer which says: "The fact that there are only these two possible maps follows from the fact that one of them is Proj(⊕π∗𝒪Y(−mH)) and the other is Proj(⊕π∗𝒪Y(mH)) and one proves that any such small morphsim has to be one of them." How do you prove that?