system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: What occurs physically that causes a person to foam at the mouth?
gpt
The foaming is usually caused when there is a lot of saliva in the mouth. For example, when someone has a seizure they can't swallow properly. The saliva builds up and grunting/gargling the saliva this causes it to become foam like. 

It's similar in neuro diseases like rabies. Rabies can cause hypersalivation so you salivate more. Rabies also makes it very painful to swallow (this is why people with rabies develop fear of water) since they aren't drinking a lot of water and salivating excessively while also not swallowing the saliva it appears as a frothy foam coming from the mouth.