With regards to the second question, if $Y$ is a $K(\pi,1)$ space then the natural map from $[X,Y]$ is isomorphic to $Hom(\pi_{1}(X),\pi_{1}(Y))$ divided (divided out by conjugacy) is a bijection (see the answers here Question about maps of $S^{3}$-bundles).
But there are examples where quite the opposite occurs, take $X = Y = S^{2}$, both are simply connected but there are infinitely many non-homotopic maps.