Hemorrhoids occur when veins in the rectum or anus become swollen and painful and may bleed. Sometimes they go away by themselves, but in other cases they can cause lingering pain, itching, and bleeding. There are two types of hemorrhoids: those that are just inside the anus or lower rectum (internal) and those that are outside the opening to the anus (external).