When a player is faced with a current bet amount that he has insufficient remaining stake to Call, and he wishes to call (he may of course fold without the need of special rules), he bets the remainder of his stake and declares himself all in. He may now hold onto his cards for the remainder of the deal as if he had called every bet, but he may not win any more money from any player above the amount of his bet.
For example, let's assume that the first player in a betting round opens for $20, and the next player to bet has only $5 remaining of his stake. He bets the $5, declaring himself all in, and holds onto his cards. The next player in turn still has the $20 bet facing him, and if he can cover it he must call $20 or fold. If he calls $20, thus ending the betting round, instead of collecting all bets into the central pot as usual, the following procedure is applied: since there is an all in player with only $5 bet, his $5, and $5 from each of the other players, is collected into the central pot (now called the main pot), as if the final bet had been only $5. This main pot (which may include any Antes or bets from previous rounds) is the most the all in player is eligible to win. The remaining money from the still-active bettors, in this case $15 apiece, is collected into a side pot that only the players who contributed to it are eligible to win. If there are further betting rounds, all bets are placed into the side pot while the all in player continues to hold his cards but does not participate in further betting. Upon the Showdown, the players eligible for the side pot--and only those players--reveal their hands, and the winner among them takes the side pot, regardless of what the all in player holds (indeed, before he even shows). After the side pot is awarded, the all in player then shows his hand, and if it is superior to all others shown, he wins the main pot (otherwise he loses as usual).
There is a strategic advantage to being all in: you cannot be Bluffeded, because you are entitled to hold your cards and see the showdown without risking any more money. The players who continue to bet after you are all in can still bluff each other out of the side pot, which is also to your advantage since they reduce your competition without risk to you. But these advantages are more than offset by the disadvantage that you cannot win any more money than what your stake can cover. After all, the object of poker is not to win hands--it is to win money.
If a player goes all in with a raise rather than a call, another special rule comes into play. There are two options in common use here: Pot limit and No limit games always use what is called the full bet rule, while Fixed limit or Spread limit games use either the full bet rule or the half bet rule. The full bet rule states that if the amount of an all in raise does not equal the full amount of the previous raise, it does not consitute a "real" raise, and therefore does not reopen the betting action. The half bet rule states that if an all in raise is equal to or larger than half the bet being raised, it does constitute a raise and reopens the action.
For example, a player opens the betting round for $20, and the next player has a total stake of $25. He may raise to $25, declaring himself all in, but this doesn't consitute a "real" raise, in the following sense: if a third player now calls the $25, and the first player's turn to act comes up, he must now call the additional $5, but he does not have the right to reraise further. The all in player's pseudo-raise was really just a call with some extra money, and the third player's call was just a call, so the initial opener's bet was simply called by both remaining players, closing the betting round (even though he must still equalize the money by putting in the additional $5). If the half bet rule were being used, and the all in player had raised to $30 instead of $25, then that raise would count as a genuine raise and the first player would be entitled to reraise if he chose to (this would create a side pot for the amount of his reraise and the third player's call, if any).
Because these rules are complicated (especially when more than one player goes all in, or there are pots to be split because of ties), informal home games often allow players to temporarily borrow money to add to their stake during a hand when necessary, which is called going light.