The Red Box only works with a pay phone which accepts coins.
When you put a coin in the phone, it sends a series of tones to the ACTS (Automated Coin Toll System). The Red Box emulates that tones, so the phone company's equipment thinks the tones were sent by the pay phone. It thinks thus that you put money in it, and allows you to call.
The pay phones don't use ACTS for short distance calls.