In addition, there are also many books that can help you How to do long division with polynomial.
That method is called long polynomial division, and it works just like the long (numerical) division you did back in elementary school, except that now you're dividing with variables.