Mao existed solely to give background to C.C. and develop her past. Lelouch obviously didn't give a fuck about her past and she wasn't inclined to tell him out of the blue, so the writers crafted Mao in order to get some of C.C.'s backstory told.
As for Shirley, I agree that she was a bit pointless. She was pretty much there to be the one girl Lelouch could have a "normal" relationship with. However in a show about magic and giant robots it was obvious that she really had no place in it. She was basically there to rope in some fans and provide some character development for Lelouch, but unless her death somehow takes on a greater significance, she will have been a pretty useless character.