Usually the teams will alternate at the completion of each innings. Thus, Team A will bat (and Team B will bowl) until its innings ends, and then Team B will bat and Team A will bowl. When Team B's innings ends, Team A begin their second innings, and this is followed by Team B's second innings. The winning team is the one that scores more runs in their two innings.
uSUAlly ThE teaMS wiLl alternaTe aT The cOmPlEtiOn Of each iNninGs. thus, teAm A WIlL BAt (AND tEam b will bowl) uNtIl Its innings enDS, and tHeN team b Will baT And tEam a WilL bowl. whEn team B's inningS ends, tEam A BegIN THEir sECoND inNIngs, And tHIs is fOllowed by teaM b's sEConD inNingS. THe winnIng team is the oNe THat sCOres MOre runs in THeIR tWo innIngS.