I have a small problem with long division when dividing polynomials of the same degree

algebra-precalculuspolynomials

I was doing long division with $$x^2 + 1$$, and $$3x^2+5$$. (the second polynomial is the quotient).
the problem I've found is related to dividing two polynomials of the same degree. Even if I know that the quotient is always a constant and the remainder is a polynomial of one degree less than the dividend, I still have problem when performing this long division, meaning:

$$x^2+0+1\space /\space 3x^2+5$$

x^2 is contained in 3x^2 3 times, so I write 3 in the quotient.

then, I perform multiplication between the quotient and the divisor. $$3 * 3x^2 = 9x^2$$, and $$3*5 = 15$$. I write them below the dividend.
Now, I subtract the dividend with the things I have below.

but, it's an infinite loop, because the degree doesn't change no matter how long I divide.

You are confusing what you dividing into with what you are dividing by and you are taking the quotient, $$3$$, and multiply it by what you are dividing into; not what you are dividing by. You must multiply the quotient by what you are dividing by.
Question 1: $$\frac {3x^2+ 5}{x^2 + 1}$$ then we divide $$x^2$$ into $$3x^2$$ and get a quotient of $$3$$. So we multiply the denominator, $$x^2 + 1$$ by $$3$$ to get $$3(x^2+1)=3x^2 + 3$$. Then you subtract $$(3x^2 + 5)-(3x^2 + 3) = 2$$. Now you have the remainder.
So $$\frac {3x^2 + 5}{x^2 + 1} = 3 + \frac 2{x^2 + 1}$$.
Question 2: $$\frac {x^2 + 1}{3x^2 + 5}$$ then we divide $$3x^2$$ into $$x^2$$ and we get a quotient of $$\frac 13$$ (because $$3x^2$$ goes into $$x^2$$ a total of $$\frac 13$$ times). So we multiply the denominator, $$3x^3 + 5$$ by $$\frac 13$$ to got $$\frac 13(3x^2 + 5) = x^2 + \frac 53$$. Then we subtract $$(x^2 + 1)-(x^2 + \frac 53)= -\frac 23$$. Now we have a remainedr of $$-\frac 23$$.
So $$\frac {x^2+1}{3x^2 + 5} = \frac 13 -\frac {\frac 23}{3x^2 + 5}$$.