You have to play a Z serve from the side, so it hits front wall and goes over to side wall before it comes to the court.
This shot will carry the ball closer to the front wall first, and then closer to the side wall.
When you hit the ball, it will collide with front wall first, and side wall afterwards, and then the ball will return to body. In this manner, it generates a Z effect.