WARNING: this post contains mature themes; please read at your own discretion.

Nothing annoys me more than when an author adds in a rape scene to be cool or edgy, “this’ll show my readers how evil and twisted my character is," they say.
Point-in-case is George RR Martin's A Song of Ice and Fire series. He constantly uses rape to remind his readers of the darkness of his characters and and his world. The voice of the victim is ignored; Martin aims for shock value.
Likewise, in Peter V Brett’s The Demon Cycle series, the first two books contain two rapes, one gang rape and at least three more attempted rapes. However, instead of a horrific, life-altering event with life-long consequences, a gang rape becomes no more than a small mark in the ledger of someone's life. The experiences of the victim are brushed off, never to be heard of or talked about again.
To those considering adding sexual violence in their manuscripts, here are some things to first ask yourself.
If you're considering writing a rape scene, first ask yourself:
Are the effects of the rape on my character only short-term?
Am I putting in a rape scene to show how evil or twisted my character is?
Am I writing in a rape scene so my character can have a sad, dark or secretive past?
Am I treating this as a passing moment which is not integral to the plot line?
Will my characters be unaffected by the ramifications of this rape?
Are the themes of the rape disconnected from the main themes in my book?
If your answer to any of the above questions is YES, then you should NOT put a rape scene in your manuscript. Your motivations for writing about this may not be in the right place; you may be including sexual violence as a trope or for shock value, therefore, you should reconsider its inclusion in your manuscript.
How much detail do I show?
If you answer NO to all of the above questions, you should then ask yourself if you need to put in a graphic description. Ask yourself:
If I don’t put in a graphic description, but rather allude to it, will the trajectory of the plot and characters' journey remain unchanged?
If the answer is YES, then you don’t need to put in a graphic description.
Putting in a graphic description is a serious decision. You must consider the effect you'll have on the reader — it could traumatise them deeply. However, you also must think of the effect on yourself as you enter into that emotional space where you imagine the sexual violence so you're able to write about it.
An author who understands
In The Book of the Unnamed Midwife by Meg Elison, there are a number of scenes containing sexual violence. However, without the sexual violence in the book, the whole plot wouldn't have made sense, nor would the themes.
Meg Elison's protagonist is deeply traumatised by the sexual violence she sees. She reflects on how wrong sexual violence is and thinks about how it connects to themes of power, survival, betrayal and fear. Her life becomes filled with paranoia and distrust as she tried to navigate in the dystopian world where women are treated as commodities.
The Book of the Unnamed Midwife is an uncomfortable, tragic read. While it wasn't perfect, it dealt with sexual violence in a thoughtful and mature way. Sexual violence wasn't used as a way to pull an emotional reaction from the reader; it showed sexual violence from the victim's perspective, and showed the ramifications.
We need more authors who approach sexual violence in books like Meg Elison, and less of the authors who see sexual violence as a trope.