Do metal atoms tend to gain or lose electrons?

The alkali and alkali-earth metals want to lose electrons. Alkali metals need to only lost one electron to have a full outer shell (8). Alkali-earth metals need to lose 2 electrons.

Transition metals are different, but remember that the outermost shell in a transition metal is NOT a d orbital. Take for example the electron configuration of the transition metal Cobalt.

Co[Ar] 4s23d7

The outer most shell is the 4s orbital and not the 3d orbital. Therefore, Cobalt "wants" to lose the 2 electrons that are in its outermost shell.