In its essence, a sex scene in a novel is no different from any other scene, and the key to writing it is to figure out its objective. If you’re just putting it in there because you think it’s time for some titillation, it will not have the resonance of a motivated scene. (Though in some novels, category romance especially, titillation alone is an acceptable objective.)
There are many other objectives for a sex scene besides titillation: to bring the couple closer together; to show that they want each other even though they can’t tolerate each other; to bring them comfort; to show the maturation of one character (perhaps he couldn’t commit, and now he can); to show the intensity of the relationship; to slow the pace of the book or speed it up; to bring a bit of humor or playfulness to a somber work.
Once you know the objective, you can write a fitting action/reaction sequence. If comfort is the objective, you can show them together at the beginning, close the door during the action, and show them cuddling afterward. If tenderness is the objective, you can show a bit of the action in addition to the before and after. And of course, if their desperation for each other is the objective, you will need to leave the door open during the scene. As with all resonating scenes, when it is over there must be some reaction, some change to the character or the direction of the story. And the objective dictates that reaction. If the scene was about bringing comfort to the characters, we need to know whether they found comfort or failed to find it, and we need to know the characters’ emotional response to the success or failure of that objective. This reaction, in turn will help set up the next scene.
Scenes also help show who the characters are, and where better to do this than when they are at their most vulnerable. The sex scene I wrote that I like best is one where the woman calls out her partner’s name, and he exults to himself, “I’ve still got it!” That defined them and their relationship.
The problem I have with sex scenes is that, in the end, there are only so many different ways of writing them and after a while they begin to seem ho-hum. Finding the objective helps make the scene unique, as does sense description not related to the act. Can they smell the garbage outside the motel window? Is the traffic only a faint hum from her penthouse? How does the office desk feel beneath her back? Each of these bits gives the scene a depth it might not otherwise have.
I wasn’t sure if I was going to have a sex scene in my current work. After devolving (or evolving depending on your point of view) from graphic sex in my first novel to none at all in my fourth, I thought I’d run the gamut. But then I realized I have never done a humorous sex scene, so that’s what I’m going to aim for. Not a bad objective.