There are basically three ways to pass the night in Morocco
Clubbing
Shows
Live music
Clubs
In Marrakech and Agadir most clubs are found within hotels so check out the major hotels in these cities if you have a challenge locating one in town.
Casablanca is more popular among clubbers since it has most of the best clubs in the country.
There are quite a number of clubs that play European and modern music such as Flamingo in Agadir and Vanity in Casablanca.
Live music and shows
The medina squares in cities and towns come to live at around dusk. The setting being carnivals like with acrobats, live music, belly dancers and street entertainers with this low-key celebration going on until late night around 2 am.
There's also a number of shows and concerts that go down across Morocco every night. You can find out what's happening at night using this local event finder website