How do I understand the statement return 1 getLine?
By first noticing that return 1 getLine is actually (return 1)getLine.
This means that return 1 is a function, since it accepts an additional argument, and functions are monadic values too (that's why it's not a type error).
Thus we must unify
return :: Monad m => a -> m a
return 1 :: (Monad m, Num a) => m a
return 1 :: Num a => r -> a -- Monad (r ->)
so that m a ~ r -> a and thus m ~ (->) r (which is the proper way to write (r ->) which is itself an invalid syntax).
For functions, return = const and so we have
return 1 getline
= const 1 getline
= const 1 undefined
= 1
because const is defined as
const :: a -> b -> a
const x y = x
(and that's how getLine gets ignored).
In general, the functions Monad instance is defined so that
do { a <- f ; b <- foo a ; return (bar a b) } x
is the same as
let { a = f x ; b = foo a x } in bar a b -- const (bar a b) x
And that's the reason for return being defined as const.
This means that return and getLine do not "cancel each other out". That's the doing of return only, by virtue of being applied to a second argument, whatever that is, even one which is undefined.
So getLine belonging to the IO "monad", as you write in the question, is irrelevant. Everything is a value in Haskell, and getLine is just another value as well. And it is a pure value at that; it just describes an "impure" I/O action, but by itself it is just another value, simply used as an argument here. Only when getLine appears in main in an appropriate position (or in other code that appears in main, recursively) is it "run", i.e. the computation it describes is actually performed. Here this is not the case.
The monad in play here is the functions monad, to which this return belongs.
As to the purity question, monads are not pure or impure themselves. A type which implements a Monad can be either pure or impure. Functions happen to be pure.
What Monads do is separate the pure from the potentially impure.
But that's actually what Functors do as well. Monads, specifically, allow then for the intermingling chaining of the pure-->impure-->pure-->impure-->.... bits, while preserving their separation (again, the "impure" bits can actually be pure themselves as well; the important thing is the separation between the two "worlds").