MathOverflow will be down for maintenance for approximately 3 hours, starting Monday evening (06/24/2013) at approximately 9:00 PM Eastern time (UTC-4).

2 added 100 characters in body

The extension will be

Note quite what you asked, but related:

Continuous extensions of (continuous) functionals from $M$ are unique if and only if $M$ is a dense subspace of $X$. Otherwise its closure is a proper closed subspace and therefore there exists a nonzero linear bounded functional $\phi$ vanishing on the closure, which implies that $F+\phi$ is bounded and also extends $f$.

For the second question, it is easier to put conditions on $M$ so that for every $Y$, every map from $M$ to $Y$ can be extended. As mentioned in the comments, a necessary and sufficient condition is that $M$ is a complemented subspace of $X$.

1

The extension will be unique if and only if $M$ is a dense subspace of $X$. Otherwise its closure is a proper closed subspace and therefore there exists a nonzero linear functional $\phi$ vanishing on the closure, which implies that $F+\phi$ also extends $f$.

For the second question, it is easier to put conditions on $M$ so that for every $Y$, every map from $M$ to $Y$ can be extended. As mentioned in the comments, a necessary and sufficient condition is that $M$ is a complemented subspace of $X$.