Its a bent structure because pushes the elector pairs which are bonded to the H down. Its not linear because it needs 2 electron pairs on each side to be linear.
I understand that it needs two pairs on both sides to be linear. The mystery to me is why does it push the electron pairs shared with the hydrogen down(instead of distributing them evenly)? The fact that oxygen is more electronegative than hydrogen is not very convincing. Likes should repel yet the hydrogen atoms are moved closer together and the electrons are concentrated at the other end.