A period where the prices of the stocks, bonds, and indexes sustainably increase is known as a rally. This price movement can happen during both the bear or bull market; therefore, it is known as a bear market rally or a bull market rally, respectively.
A rally is followed by a period of flat or decreasing prices. It happens due to a significant increase in demand resulting from a large capital investment into the market. The extent of a rally depends on the depth of buyers along with the amount of selling pressure they go through.
In case there is a huge pool of buyers and few investors willing to sell the same securities, then there is likely to be a large rally.
A rally can happen due to many reasons. Like, short term rally can result from a news breakout or events that create a short-term disbalance in supply and demand. Or, the introduction of a new product, a significant buying activity of a particular stock by a large fund can also result in short term rallies.