What you ate is often to blame, but infections and medications can play a role, too.