Hemorrhoids bleed due to repeated trauma from the passage of stools during a bowel movement. Harder stools specifically can cause bleeding, which is why we recommend softening stools with a high fiber diet or stool softeners during a flare up.
Avoid scratching and touching bleeding hemorrhoids as much as possible, which we talk more about in our Ask the Doctor series here.