Trading "on margin" is risky, because margin accounts allow you to borrow money to trade. To lessen this risk, understand all of the things you can and can't do on margin, and what those actions might cost you. You certainly can hold dividend-paying stock in a margin account, but dividends are one of those potentially costly things. The cost depends on who is holding the stock and how.
In a margin account, you are allowed to borrow money and securities from your broker to make trades. You can borrow money to purchase -- buying on margin -- or you can borrow shares to sell -- selling short. In return, you agree to keep cash and securities in your account equal to a specific percentage of your margin loan, and to pay interest on the borrowed funds or assets. Your broker can also loan your assets to other margin account traders.
Dividends on Loaned Shares
When a trader loans out a dividend-paying stock, he is still the registered owner of that stock and has the right to receive all dividends paid during the course of the loan. However, the person who buys the owned shares may also have the right to a dividend, since she owns shares, too. In these cases, the actual dividend goes to the buyer of the loaned shares. The brokerage firm pays the lender a substitute payment, also known as a payment-in-lieu of dividend.
There are two types of dividends for tax purposes: ordinary dividends and qualified dividends (the type is determined by the issuer). Ordinary dividends are taxed at ordinary income rates, while qualified dividends may be treated like long-term capital gains and taxed at a lower rate. If you own a stock, you get the dividend as a "real" payment, and if it's qualified, you get the lower tax rate option. If your shares are lent out and you receive payment-in-lieu, it is always treated like an ordinary dividend, even if the actual dividend was qualified.
Controlling Your Risks
Your broker can't loan out your shares without your permission, so in that sense you'll never have a payment-in-lieu you aren't prepared for. However, most margin accounts allow your broker to borrow shares from your account if you have not met your minimum margin requirements, that is, if you do not have cash and assets in your account to cover your agreed-upon percent of borrowed funds. In most cases, you do not have input as to which shares are lent out. Most brokerage firms will avoid lending dividend-paying shares over a dividend payment period to avoid a payment-in-lieu headache, and many will adjust the payment to reflect the higher tax obligation you assume. Every firm is different, though, so make sure to read over your margin agreement to verify the rules for your account.