Sex seems to be pretty hurtful for feline for example. On the other hand sex is pleasurable for humans. Why is sex pleasurable for some and not for others? How do these things evolve?
There are various selection pressures that may lead to sex being more or less harmful. I don't think there is an easy way to summarize these selection pressures other than just going through load of examples. Here is an attempt to give you some notions of why can sex be pleasurable and/or painful. Note that I do not consider myself particularly knowledgeable in this field.
Why could it be pleasurable
We tend to seek for positive experiences. If we like sex, we have more sex. If we have more sex, we are more likely to have more offspring. Hence, the trait "liking having sex" is positively correlated with "fitness".
Why could it be harmful
In many species, the penis has spikes and stuff and is most definitely hurting the females. Here is a Drosophila penis
And here are penises of two dragonfly species
Here is a feline penis
By the way, according to wikipedia (could not find peer reviewed paper on the subject so take this with a grain of salt), some humans still have on remnants of those barbs you can still see on many feline penises left from our ancestor. They are called hirsuties coronae glandis. Here is a perfectly healthy (but I would tend to consider quite extreme) example of hirsuties coronae glandis
There is a lot to say here and I only want to say a few words and hopefully you will go get more information by yourself.
So why do these species evolve these fancy and scary "armed" penises. In many species, it is a small investment for a male to make a baby (just mate and the job is done) but a big investment for the female (producing the egg, eventually even parental care, ...). Because the sex-ratio is always (assuming no group selection) pushed toward 0.5 (see this post and Fisher's principle), it happens that males end up with lots of free time looking for females (see Why are female not competitive for reproduction like males? and Bateman's principle). You might also want to read about sexual conflict.
Why would such penis evolve?
The reason vary among species. Here is a non-exclusive, non-exhaustive list of reasons:
In some species (e.g. nudibranch, damselflies)The goal is to remove the sperm from an eventual previous male so as to reduce sperm competition (Cordero-Riviera, 2016).
In some species, the goal is to damage the female reproductive track so that she will not subsequently mate with other males hence reducing sperm competition ().
In some species, the male can even leave toxic products in the female (Chapman et al., 1995).
In some species, females get severly harrassed by males for mating and rape is not unusual (e.g Drosophila). Some penile barbs and spikes can be used to get the female stuck in place. To avoid that the female can escape before the sperm has been delivered ()! That being said, in some circumstance such use of spiky penis might be beneficial to the female too. This non-peer reviewed article may bring some light.
In some species, the male can pierce through the female abdomen to deliver its sperm. This is called traumatic insemination.
In a classical experiment, Rice 1996 shows that there is an arm race between males and females. Race in which males increases their negative impact on female's reproductive organs and females protect themselves from it. The paper is free, is short, easy to read and has a pretty amazing experimental design. It is worth having a look at it.
Feeding the babies via the mother
I just want to point with other examples that sex does not have to be romantic in many species. In some species, the female eats the male after sex or even while having sex. To what I have heard (; please be cautious with this information), in some mantis prey, the male does not even release his sperm before the female has cut the male's head off. Why would the male do that?
A male that let himself get eaten by the females ensures that the female has lots of energy for taking care of her babies. Hence a male may increase his fitness by sacrificing himself to his partner.