It is good that you thinking about HIV infection, as this is certainly a risk of having unprotected sex, and it is important to get tested regularly.
How frequently you get tested depends a lot on what your sexual habits are like. At a bare minimum, you should have a yearly physical check up with your primary care doctor
. At that visit you should quickly review your sexual health and habits. If you have had unprotected sex with new partners in that year, then it makes sense to get tested at least at that yearly visit. However, if you have riskier sexual habits (multiple partners, frequent unprotected sex, etc) then you may need to be tested more frequently. Your doctor will be able to advise you on this.
In addition to testing for HIV, I highly recommend that you try to avoid unprotected sex. This is the most risky thing you can do, as wearing a condom is a highly effective method for preventing not only HIV infection but also many other sexually transmitted infections such as syphilis, gonorrhea, and chlamydia. Please talk to your primary care doctor for more information.