If your characters are alive, odds are good that they will be having sex at some point -- or thinking about sex, or running from sex, or hoping for sex. This just happened to my mom character. Out of the blue, she started remembering her first sexual encounter with her husband, who is a man she has loved and a man she is not entirely sure about anymore. One minute she was vowing to keep secret the fact that she had spotted her husband on a compromising video (compromising in a professional way, not a personal or sexual way) and the next, she was thinking about sex.
As a writer, it's my job to figure out what this moment was like for these two people, what it meant, how it unfolded, if it was an experience that made them happy or sad or satisfied or shamed or any one of a thousand emotions. Sex scenes are very difficult to write because everything else is stripped away and all you've got to work with are the characters and the emotions. There's nowhere to hide. But that's also what makes them so powerful.
Here are a 7 rules to go by when going to write a sex scene:
Focus on the dialogue. Why? Because it's pretty easy. No one's giving a long soliloquy in this situation -- or if they are, they're a very strange duck, which would actually give you a lot of material to work with.
Consider the difference between the internal and the external action. Is one of your characters just waiting for it to be over? Planning out a shopping list? Thinking about someone else? Looping Britney Spears' lyrics through her brain? Those would all give you great opportunity to reveal something authentic about these people.
Make sure your characters stay in character. A proper southern lady would probably never use the work f*** and a truck driver would probably never utter the phrase "make love" -- but then again it could be a revealing surprise if he did. Either way, the language they use to describe sex and body parts is critical to your characters' identity and to their believability in the story. You can't let the author's sensibilities intrude on the characters'.
Remember that they're just words. All the same rules apply to sexually-charged words as apply to words about gardening or kite flying or race car driving. You can make a sentence about planting tomatoes better by making sure that it has good rhythm and pacing, and correct grammar. The same is true for a sentence about kissing.
Watch your tone and don't let anything become too crass. I recently had the great pleasure of coaching a very talented writer on a beautiful and moving memoir that was decidedly X rated. Not just a little X, a lot of X. I was, on occasion, shocked by what I read, and I learned some things I never knew I never knew, but only once did I make the comment that a line was too crass. It had to do entirely with tone. In a sex scene where people are desperate or angry or full of regret, the tone will be very different from a sex scene where people are lonely or tender or full of longing. A line that doesn't make you blink in one kind of scene might make your stomach turn in another -- which can be a good thing if you're doing it on purpose. If you don't intend that kind of shock, make sure your tone stays within the boundaries of your characters' emotions.
Prepare for the inevitable confrontation. While you want to write as though no one is looking over your shoulder, one day, you may be sitting in a room full of readers who have all eagerly read your sex scenes and wish to comment on them. I have had people rush up to me and tell me my sex scenes were hot, and I have had someone ask me point blank if I ever do a particular act my character did (no way am I saying what it was -- and no way did I answer her, although I thought it was actually a very interesting question, because it called to mind that whole notion of what fiction is. It's a lie. But it feels like truth. And if you do it well, readers may not understand where one begins and the other ends. In my mind, that means I did a good job.
Set the stage for doing good work. What this means is that it's not a good idea to develop a sex scene when your fourteen-year-old might walk into the room at any moment or you expect your mother to call and say, "What are you working on?" You want to feel as though no one is looking over your shoulder.
For a hilarious and more, um, detailed list, see this piece by Steve Almond from 2005.
There's a whole book on how to write sex scenes. Who knew? It's by Elizabeth Benedict, who sounds very much like a Jane Austen heroine, does she not?