There are typically five ways a cricket innings can end.
All out - If a team on strike loses ten of its eleven batsmen (usually due to them being dismissed or "bowled out," but injuries can also stop batsmen), preventing it from presenting a proper batting partnership on the cricket pitch, the team is declared "all out" and its innings is ended.
Limited overs - In a one-innings cricket match, there will be a declared limit to the number of overs each team can bowl. Once that limit has been reached, the innings is closed.
Won by wickets - If a team is last to bat, their goal is to "chase" runs and overtake the other team's total. Like in Baseball, the moment they have overtaken the other team's total, the innings and match is ended, and the chasing team is declared to have won the match by however many wickets they still possess.
Declaration - In First Class and Test cricket, time becomes an important consideration. If a team's captain feels that they have established a lead they can fully defend against the other team, he will "declare" his team's innings closed and give his team more time to bowl the other team out and conclude the match.
Draw - This is what happens when time runs out in a First Class or Test match. If the end of the final day is reached without the match coming to a conclusion, then the innings and match are ended there and the match is declared a draw, with neither team given a win.