There are models of OCD that therapists follow, and a simple one is as follows:
Let’s walk through the model. First, an event or emotional experience occurs and triggers an obsession. For someone without OCD, this situation is probably no big deal, but a person with OCD tends to find ordinary situations threatening. In order to deal with the resulting anxiety, many people with OCD want to run away when it happens or avoid it altogether.
For example, there are people who suffer from obsessions about harming others. They may think to themselves, “I wonder if I punched the bus driver when I got off the bus?” They would become anxious, thinking that they might have harmed someone.
Or they will want to make sure they did not do anything harmful so they can alleviate (avoid) the feelings of anxiety they are experiencing. Therefore, they might want to run after the bus to see if they harmed the driver, or they may go home and listen to the news to see if there are any reports of bus drivers being attacked by passengers.
Although this ritual may lead to that quick feeling of relief, it also prevents them from learning that they could have handled the situation by sitting with the thought and recognizing it as an obsession. Instead, they inadvertently confirmed that the obsession could have been true and that they are safe only because of performing the ritual.
Therefore, the next time the situation presents itself, they will be more likely to avoid it or seek reassurance to feel safe instead of facing it. This is how OCD behaviors are maintained.