It depends. I had my first at 40 weeks with DD, then about every 36-48 hours after that.
This time I'm getting one at 39 weeks as they don't want me to go over my due date because of the bleeding I've suffered. This is on the off chance the placenta is starting to fail.
It is a bit like a smear but it's fingers and not a speculum. If the cervix is far back (which mine always seems to be!) they can struggle to reach, particularly if they don't have very long fingers. If they're struggling to reach it can be a bit painful but if they can reach and they're good at it then it won't. My midwife last time had long fingers and she never hurt me (she did the first and last) but I had two other midwives do it (second and third times) and they hurt!