In the definition of a functor, why is it necessary that $F(id_{A})=id_{F(A)}$? A functor $F$ is defined to be a mapping from category $\mathcal{C}$ to $\mathcal{D}$ such that:
(1) $F(f\circ_{\mathcal{C}} g)=F(f)\circ_{\mathcal{D}} F(g)$ (say, for a covariant functor).
(2) $F(id_{A})=id_{F(A)}$
Question: why is (2) necesssary?

Here is an attempt to show that (1) implies (2), I would appreciate to be told where it fails:
Take any $f\in hom_{\mathcal{C}}(A,B)$, $g\in hom_{\mathcal{C}}(B,A)$ Then $$ F(f)\circ F(id_{A}) \stackrel{(1)}{=} F(f\circ id_A) = F(f) $$ and $$ F(id_A) \circ F(g) \stackrel{(1)}{=} F(id_A \circ g) = F(g) $$
So that $F(id_A)$ satisfies the axioms of an identity (assuming that $F$ is surjective, though I'm not sure what that means for functors), and since identities are unique (an easy lemma) then $id_{F(A)}=F(id_A)$.
The two problems, as noted are:
(a) $F$ might not be surjective.
(b) $hom_{\mathcal{C}}(A,B)$ or $hom_{\mathcal{C}}(B,A)$ might be empty.
Can anyone explain more about this? Show an non-stupid example where something would fail to be a functor because of this?
 A: If $M$ is a category with one object $O$, then $(\mathrm{Hom}(O, O), ∘)$ is a monoid, and conversly, every monoid $M$ can be made into a one-object category the morphisms of which are the elements of that monoid, and composition is monoid product. Furthermore, monoid morphisms correspond to functors between the one object categories constructed in this way. This is often a simple and useful example to keep in mind
Now take any semigroup morphism of two monoids that isn't a monoid morphism (ie. it satisfies $f(ab) = f(a)f(b)$, but not $f(e) = e$), and you'll get your counterexample. To construct these, it's easiest to note that the unit must map to an idempotent, and go from there: for example, $(ℕ, \cdot) → (ℕ, \cdot)$, $n ↦ 0$, or $(ℕ, \cdot) → (ℕ × ℕ, \cdot)$, $n ↦ (n, 0)$ will work.
A: Consider the following counterexample.
Let $\mathcal{C}$ be the category with one object $C$ and one morphism $\mathrm{id}_C$. Let $\mathcal{D}$ be the category with one object $D$ and two morphisms $\mathrm{id}_D : D \to D$ and $f : D \to D$, where composition is defined by $f \circ f = f$.
Define $F : \mathcal{C} \to \mathcal{D}$ by
$$F(C)=D \qquad \text{and} \qquad F(\mathrm{id}_C)=f$$
Then $F$ satisfies all the requirements of being a functor, except for the requirement that $F(\mathrm{id}_C)=\mathrm{id}_{D}$, since $F(\mathrm{id}_C)=f\ne\mathrm{id}_D$.

Added: As per your question in the comments, here's an example where $F$ is surjective on morphisms: take $\mathcal{C}$ to be a category with two objects $C_1$ and $C_2$ and only identity morphisms, take $\mathcal{D}$ as before, define $F(C_1)=F(C_2)=D$, $F(\mathrm{id}_{C_1})=f$ and $F(\mathrm{id}_{C_2})=\mathrm{id}_D$.
A: If $f:\cal C\to D$ is full, then (1) implies (2):
Let $x$ be an object of $\cal C$ and let $y=f(x)$. Assume $e$ is one of the arrows at $x$ such that $f(e)=1_y$. Then we have 
$$
f(1_x) = f(1_x)1_y =  f(1_x)f(e) = f(1_xe) = f(e) = 1_y
$$
Also, if $\cal D$ is a groupoid, (1) implies (2) since
$$
f(1_x) = f(1_x)1_y = f(1_x)f(1_x)f(1_x)^{-1} f(1_x 1_x)f(1_x)^{-1} = f(1_x)f(1_x)^{-1} = 1_y
$$
