Even if some DJs tend to improvise when they are performing in front of an audience, I recommend you to consider the following points to put the odds on your side.
Inform yourself about your performance and your audience
What style of music do you intend to play? What's your slot in the lineup: are you the opening act, the main act or the closing act? Who will perform before and after you? These criteria will help you decide the best songs depending on the audience's energy, its motivation and how the lineup evolves.
Consider the gear you will be using
Will you be using your own gear (MIDI controller, laptop, decks...), with which you will hardly have any surprises, or someone else's to which you are not used to? In the second case, try to find out the deck or mixer model to look for information on the Internet (how to use pre-listening with headphones, how to use effects or filters...). You can also do it on-site by asking other DJs how the mixer works (for example). The idea is not to find out during your session!
Prepare your set in advance
Not all DJs will agree with this approach, but if it's your first time or you simply don't feel comfortable enough, I strongly recommend you to prepare your set in advance. You can take your time to choose the songs you want to use and the order in which you will play them to make the session as coherent as possible. You can test your combinations "with a clear head" and record yourself several times to put the result into perspective.
Know your songs by heart
This might seem obvious to any DJ who is worthy of the name, but a reminder can't hurt! Listen to your playlist on a regular basis several days before your performance, for example on your car, at work, on the subway... The idea is to know each track perfectly well, considering that you will be playing them in public under unfamiliar acoustic conditions.
Make sure you don't get distracted during your session
When you are on the decks, focus solely on your set and don't worry about what's going on around you. Try to avoid having people from the audience come up to you while mixing to ask "how do you go from one record to the other?" or "can you play song XXX?"... There's nothing worse than being distracted over such insignificances!
Article written by YannOO (Yann Costaz), DJ, producer and electronic music lover since 2003.