The glue created by \hfill only expands enough to fill the
container it is put in. This container must therefore have a
fixed size to fill. In your first example, the container is one
line of a paragraph. This has the fixed size \hsize. In the
math mode cases, the container is the math mode itself,
which has no fixed size and will only be as wide as it needs
to be. The only way out is as in the first example:
Vector $v=($\ansgrow,\ansgrow$)$ and $x={}$\ansgrow.
Alternatively, wrap these in containers of fixed size:
Vector $v=(\hbox to 6cm{\ansgrow,\ansgrow})$ and
$x=\hbox to 3cm{\ansgrow}$.
Dan