Writing a fictional sex scene is about the characters, their emotions, and the events in the story. You will not find a formula that tells you how to craft the scene; it is dependent on unique elements found only in your novel. The most important aspect of a sex scene is that it fit with the story and have a purpose in the "bigger picture" of your novel's plot. Sex in a novel isn't only about the physical act, but the feelings surrounding it and the repercussions afterward.
Get to Know the Characters
Interview your main characters before you get too far into writing the story so that you understand who you're writing about. Their thoughts and decisions are what drive the story forward. One way to interview a fictional character is to come up with a set of questions about his likes, dislikes, hopes, fears, and childhood history and record the answers.
Determine your main characters' "GMC"--Goal, Motivation, and Conflict. Goal is what the character wants. Motivation is why the character wants the goal. Conflict is what prevents the character from obtaining the goal. These three items govern every action your characters make in the story, including deciding to sleep with each other.
Differentiate the characters' internal conflict (what they are fighting within themselves) from their external conflict (what they are fighting against in the outside world) so that both are clear in your mind and separate from one another. One or both of these conflicts could have an impact on the characters' thoughts and behavior during a sex scene, so it's important to define the conflicts before you write the scene.
Determine how the sex scene will increase the conflict between the two main characters. Generally, when two characters sleep together, there's more involved than sex. Great conflict comes from someone or something at risk. Think about ways your scene increases the stakes in the story.
Determine how your characters will react to making themselves vulnerable enough for intimacy. Depending on the internal conflict you've laid out for them, this moment in the story could be a very big deal.
Crafting the Scene
Visualize the scene in your head, as if you were directing a movie, in order to write the physical action of the scene, but steer clear of prose that sounds like "Insert part A into slot B." That's fine for a first draft, while you're choreographing the stage directions to get the gist of the scene on paper, but it won't work for the final version. It's too technical and anatomical.
Pick one point-of-view (POV) character for the scene. Do not "head hop" and jump back and forth between what both people are feeling. That confuses the reader, who is looking to identify with one character at a time. The second character's POV can be shown through his actions and reactions during the scene.
Focus on the emotional as well as the physical when writing a sex scene. Write what the characters are feeling, not just what they are doing. Place yourself inside the body of your POV character and write from that perspective, not from that of an observer watching from the sidelines.
Consider where the sex scene fits within the larger plot of your novel. Don't just plunk it in because you think the characters should be having sex by now. It needs to flow from the events of the story and from the actions and emotions of the characters.
Think about the timing of the sex scene. Look at what is happening around the characters. If they're in a suspenseful story and running for their lives, stopping to have a quickie probably will not make sense.
Consider the setting of the scene. An intimate encounter in a rowboat may sound interesting, but think about the logistics of it. Is one character getting a plank of wood shoved in his back? Readers pick up on these details, and if they find your scene improbable, the rest of the story could lose credibility.
Don't forget dialogue. One of the sexiest tools an author has in her arsenal is dialogue. What the characters say to each other can be as sexy as what they're doing together and goes a long way to heating up the scene.
Depicting safe sex and the use of condoms in a sex scene is fine, but avoid being too heavy handed about it. Weave it in with the other elements of the scene, the actions and the emotions, so it doesn't jar the reader out of the scene like a public service announcement.