However, if your stock falls to $40 in price, you'll still owe $50 to your broker. Selling the stock, however, only raises $40. In order to make the broker whole, you'll have to pay an additional $10. This is the simplest way you can end up owing money on a stock.
Depending on how much leverage you use for your purchases and how your other investments perform, you may end up getting a margin call from your broker. The Financial Industry Regulatory Authority (FINRA) requires you to maintain at least 25% of the total value of securities as margin. Some brokers require more. If your account dips below that threshold, the broker will require you to add more funds or liquidate your holdings.
In the above example, if that $100 stock purchase was your only holding, you'd get a margin call when your account falls to $66.67 in value, if not before. If you subtract the margin loan of $50 from that amount, you'll have $16.67 in actual equity that you own free and clear. That's 25% of the total account value of $66.67.
Cash accounts vs. margin accounts
Most beginner investors start with a simple cash account. With a cash account, you deposit funds, and that's what you're able to buy stocks with. If you sell shares to raise more cash, you'll have to wait for the funds to settle three days later before you can use them to make another purchase.