Know your audience. If you are the DJ for a college party, you will have a different audience than at a 40th birthday party. If you are the DJ in a club, think about what time your set is on. If it's earlier in the night, consider a more chilled out set, whereas later in the night, people will want to dance. Think about the mood and age of your audience, and use this to give a broad idea of what genre of songs to play.
Choose the songs that you will play, plus a few others, and burn these onto at least two CDs. Decks in clubs regularly use two CD players, which you alternate between. Make a list of which songs are on which CD, and how long each song is. Make a note of how long the intro is on each song.
Plan a playlist, making a flow of songs throughout the setlist. For example, if the DJ before you is playing funk, and you want to finish on hip-hop, choose 'bridge' songs that will gradually shift from one genre to another. In this instance, a song by Prince would work well.
Choose a big finish. When you are a DJ, people will usually remember the last song you played. If you finish with something good, then earlier sins are usually forgotten. Keep your finish song in mind and leave time at the end of your set for this.
Be flexible, and have plenty of spare songs in case you've misjudged your audience. In these cases, having a range of CDs available will help you rectify problems. For example, if your audience keeps requesting pop songs and you planned on playing classic rock, you'll want the flexibility to keep them happy. Ultimately, you are there for them, so you should play songs that will keep them dancing.