In Costa Del Sol, Marbella and the city of Málaga have the best nightlife.
Stay in Malaga for nightlife
I’d recommend staying in Málaga and visiting the rest of towns in Costa del Sol from there. Malaga is cheaper than Marbella and thanks to a large university has a young cosmopolitan crowd.
How to enjoy your night in Malaga
In Málaga, you should go to the area around Plaza Uncibay and Calle Beatas, which is where all the clubs, bars, and discotecas are. Metro Copas, Monkey House, La Guarida are all good places around there. A very cool one is Rocking Beatas, especially if you like rock music. It's also known for the “Aliento de Dragón” shot. I definitely recommend trying that.
Another cool place to visit is Sala Premier, which is decorated with film memorabilia like pictures of actors, lord of the rings/Batman/game of thrones/western movies decorations, so if you’re into that kind of thing, check it out.
Aside from all of that, there are hip discotecas like Velvet, Gold, Bubbles…
If you don’t want to visit either Marbella or Malaga, the general consensus here is that Fuengirola, Benalmadena or Torremolinos are the best places in Costa Del Sol. These towns have a good nightlife scene, with plenty of discos and clubs in their respective city areas. They’re probably cheaper than Marbella and have a similar cosmopolitan vibe as Málaga (especially in the summer months.)
If I had to make one choice, it would be Benalmádena. Plaza Solymar (24hr square) is notorious for its nightlife. The square is home to lively bars and clubs.
Bear in mind that Plaza Solymar caters to younger, stay-up-all-night crowd. It is tacky and loud. Do not expect a nice quiet drink at Plaza Solymar. If boisterous nightlife suits you, look for an apartment towards the east of Benalmádena and you will be closer to Plaza Solymar.
On the other hand, if you want a quieter nightlife, you should consider Fuengirola. It is lively at night but not over the top. You will not see any of the hen and stag parties at Fuengirola. The other town on the same lines would be Nerja. Tutti Frutti, the small square at Nerja is great to enjoy nightlife without the excess of Plaza Solymar.
I love Marbella for its nightlife. It is the place to see and to be seen. Puerto Banus has the reputation of being party playground of the rich and famous.
Yes, it is expensive and luxurious but offers the best of what one can expect - trendy nightclubs, good food, beautiful people, and an excellent ambiance.
Here is a good guide on nightlife in Marbella.