Sorry OP that this has happened to you. It does sound terrifying and very violating to look up and have this happen to you.
I just wanted to say that I'm sorry that happened to you. I'm always paranoid (and sadly, have come to accept it) that some creepy person has put in a camera in there. You hear stories about that on the news from time to time, so I think it probably happens more than we even know. I don't know if he was after your purse or what, but I think that would've been terrifying and I'm glad you were able to scream to scare him off and get others' attention.
Yes, I thought the OP was going to say she saw a camera recording her. That would be violating enough, let alone see an actual person peering over.
The local news has mentioned a few times to not to hang one's purse on the top hook the back of a stall door, if there is an upper & lower hook. Although, a thief who snatches bags regularly from bathrooms probably has practiced lifting up the strap, and pulling it forward, then up again, to bypass the top hook. No need to peer over from the neighboring stall to steal a bag.
And have you ever noticed most Womens Restrooms are located so that we have to walk past the Mens and we are usually next to the emergency exit door .
I have noticed how the womens room is often down the far end of a lonely corridor, yes, past the men's room, (where a predator could be waiting inside and peering out as a woman passes, to jump her from behind,) and often in the dead end area of the corridor, so there is only ONE way for a woman to run and escape, and possibly have the way barred by the attacker. Also, not likely that someone would randomly pass by as a woman is screaming or being raped inside those womens room. It would likely be only when another woman is going to the bathroom that she'd hear screams.
A few weeks ago, here in NYC, it was announced that new restrooms are being put in various subway stations. They are all UNATTENDED by employees. We
already have problems of predators grabbing women and dragging them off, down in the subway platforms to rape them.
I rolled my eyes when I heard about the new bathrooms, as now the predators have a whole empty, open room to attack a woman without witnesses or possibly help for her.
Sure enough, 3 DAYS AGO, the news reported how a woman was almost raped in a subway bathroom.
https://nypost.com/2023/02/16/homeless-career-criminal-accused-of-trying-to-rape-nyc-woman/
PSA: For your own safety, there are safer bathrooms if (general) you really need to go while out and about. There are plenty of Starbucks cafes with bathrooms open to the public, above ground, with plenty of pedestrians around (hopefully not IN the bathroom with you.
) Or bars or restaurants or hotels where you can enter to use their bathrooms.