The type of map is map :: (a -> b) -> [a] -> [b]. Hence the type of map foo is obtained from [a] -> [b] by substituting a and b with what can be derived from foo's type. If, for example, foo :: t -> t, you substitute a = t, b = t and obtain [t] -> [t]. If foo :: [t] -> Int, you obtain [[t]] -> [Int].
In your case, the type of foo (which is map) is (x -> y) -> [x] -> [y]. You have to unify that type with a -> b to find out what a and b have to be substituted with. [Note that the function arrow is right-associative, x -> y -> z = x -> (y -> z).]
To find the type of
\x -> x >>= (\y -> y)
use the known type of (>>=) :: Monad m => m a -> (a -> m b) -> m b. Ignore the constraint (Monad m =>) for now.
As the first argument of (>>=), x must have a type m a for as yet unknown m and a. The second argument of (>>=) is here the identity,
(\y -> y) :: t -> t
so you must unify t -> t with a -> m b. That gives you some information about a, namely a = m b.
That gives x :: m (m b), and (\x -> x >>= (\y -> y)) :: type_of_x -> type_of_rhs.
Finally remember the temporarily forgotten constraint Monad m =>.