You win by checkmating your opponent's king — attacking it so it has no legal escape. You also win if your opponent resigns, or runs out of time (provided you have enough material to mate). You do not win by capturing pieces or the king itself; capturing material is just a means to the end of delivering checkmate.