I wander whether there is a theory that explains the stock exchange behavior (or a single stock) by assuming some transitions between (maybe almost) well defined states. If, I will appreciate a short explanation of the theory or a reference to it. Thanks!
Your question asks about the behavior of a stock exchange as a whole and the behavior of a single stock. You need to clarify what you're looking for.
There's the Efficient Market Hypothesis which is about the market as a whole. Personally I think it's garbage. Here it is in some detail: https://www.investopedia.com/terms/e/efficientmarkethypothesis.asp
There's Modern Portfolio Theory, which is the cornerstone of 95% of the investment industry. It breaks down a bit in times of extreme volatility and increased correlation between markets. More details here: https://www.investopedia.com/managing-wealth/modern-portfolio-theory-why-its-still-hip/