Extracting the obvious common factor #color(green)(""(3y))# should be fairly obvious.
The more difficult problem is whether the remaining factor #color(brown)(""(2y^2+y-1))# has any factors.
Treating #color(brown)(""(2y^2+y-1))# as a quadratic of the equation #ay^2+by+c=0#
and applying the quadratic formula: #y=(-b+-sqrt(b^2-4ac))/(2a)#
we would get
#color(white)("XXX")y=(-1+-sqrt(1^2-4(2)(-1)))/(2(2))#
#color(white)("XXXX") = (-1+-3)/4#
#color(white)("XXXX")= -1 or +1/2#
This implies #color(brown)(""(2y^2+y-1))# has (incomplete) factors #color(green)((y+1)(y-1/2))#
Multiplying #(y+1)(y-1/2)# gives #color(blue)(y^2+1/2y-1/2)#
which implies that an additional factor of #color(green)(2)# is required.
So #color(brown)(2y^2+y-1) = color(green)(2(y+1)(y-1/2)#
or#color(white)("XXXXXXX")=color(green)((y+1)(2y-1))#