Donating appreciated securities to charity can help both you and your favorite nonprofits – if you do it thoughtfully.