Infix operators whose names end with : are interpreted as method calls on the right operand. So 1 :: 2 is 2.::(1), i.e. it calls the method :: on 2. Similarly 1 :: 2 :: Nil is Nil.::(2).::(1).
The reason that the first one does not work is that 2 is an Int and Ints do not have a :: method. The reason that the second one does work is that Nil is a list and lists do have a :: method. And since the result of List.:: is also a list, you can still call :: on the result of the first ::.