In Twenty20 and ODI matches, there are two innings in which either team is given a chance to bat. In test matches, there can be up to four innings in any match.
The length of innings depends on the type of match being played.
In Twenty20 cricket, each inning can last up to 20 overs. The first innings of the match will usually last that long. The second inning can also go 20 but could end early for other reasons.
In ODI's, each inning can last up to 50 overs. Similar to Twenty20, a first ODI inning is more likely to last the full 50 overs than the second. But this is more difficult as there is more opportunity to get an entire team out.
In test matches, innings have no defined lengths and can last over multiple days in certain matches. Innings in test matches are the only innings that don't end because of a threshold of overs.
The number of innings in cricket depends on which variation of cricket is being played. A team's innings can either be one set of innings of two set of innings.
Innings in cricket can end in a variety of ways. They are:
In both Twenty20 and ODIs, as mentioned above, there are a defined amount of overs. If the maximum amount of overs is reached at any point during an innings, the innings end.
While the batting team is trying to score, the bowling and fielding team are trying to take wickets. In all forms of cricket, if a bowling and fielding team is able to take 10 wickets within an inning, it ends.
In test matches, an inning can also end by the captain declaring. To win a test match, a team must score more runs and take all 20 available wickets. Because of the need to play at least three innings to win, captains of batting teams who have scored a lot of runs in an inning can declare to end the inning in order to give their team a chance to win.