What cause market-wide trends in general, rather than company-wide trends?
The psychology of the market participants does in both situations.
A general market trend can cause participants in individual companies to follow the general market trend, even if the company's health is opposite to the general market trend. A general market trend can be sparked by some economic event but is driven by the fear/greed of market participants.
Similarly, the trend of an individual company may be sparked by some financial news about the company or the general market consensus but is driven by the fear/greed of the company participants.
Algorithmic trading has been floated as something that creates correlative movement, as well as deepening particular moves.
"...behind the broad, swift market slide of 2018 is an underlying new reality: Roughly 85% of all trading is on autopilot—controlled by machines, models, or passive investing formulas, creating an unprecedented trading herd that moves in unison and is blazingly fast."
Many factors contribute to and influence market direction. This can include change in interest rates, change in the price of oil, inflation, monetary policy (Quantitative Easing), geopolitical events (invasion of Kuwait), economic events (low unemployment numbers, consistent number of jobs created, consumer confidence and spending), legislation (Trump tax cuts) geopolitics (Brexit, invasion of Kuwait), political chaos (Washington today?), etc.
Some of the above events also affect individual companies particularly if it's a sector affected by them. Interest rates and banks? Oil price and manufacturing? Consumer spending and retail stores? Company trend basically comes down to earnings. Anything that affects earnings is going to point the direction. M&A? New contracts? New product lines? Successful clinical trials? Lawsuits? Slowing corporate earnings and lowered forward guidance?
Market psychology can come into play in both areas. Fear and uncertainty can take hold despite little change in the economy (see markets down 20% over the past two months).
Anything that affects the economy as a whole will affect the markets as a whole.
Additionally, anything that causes uncertainty tends to be bad for the markets. I read once -- haven't verified it but sounds plausible to me -- that the market tends to go down in the months leading up to an election, and then whoever wins, it goes up after the election. At first it may sound irrational to say that not knowing what government policy will be hurts more than knowing that government policy will be bad for business, but it's not as crazy as it sounds. Government policy isn't usually good for all businesses or bad for all businesses. It's good for some and bad for others. When investors don't know what the policy will be, they don't know what businesses to invest in, so they hold back, wait and see. Once you know, then you can safely (more or less) invest in the businesses that will benefit from the new policy.
As I write this, December 2018, the US stock market is taking a beating. Most analysts blame this on, (a) Federal Reserve raising interest rates, (b) unresolved trade issues with China, (c) government shutdown over border wall controversy. Note that (b) and (c) are mostly in the "uncertainty" category.