The question of how media influence public opinion began being asked in earnest after World War II, when researchers first tried to model the ways information reaches a mass audience. Since then, a whole gaggle of theoretical frameworks has sprung up, with their roots in such diverse fields as cognitive psychology, political science, linguistics and semiotics.
These theories can be placed on what I call a high influence-low influence spectrum. On the one end we find 'hypodermic syringe'-type models, which predict a more or less direct link between media content and public opinion; what you consume is what you believe. On the other end of the spectrum theorists assign a great deal of autonomy to audience members themselves; individuals actively seek out what information they want to receive, and media outlets respond to this demand by tailoring their coverage to their audience's preferences.
The outer fringes of the spectrum are somewhat dimly lit and underpopulated nowadays, but the middle is vibrant and full of life. In this middle section, theorists borrow freely from diverse scholarly fields in order to encapsulate the complexities of how media coverage works and how people's opinions are formed and maintained. I'll briefly gloss over the most important ones.
First, agenda-setting theory states that the media cannot tell us what to think, but can tell us what to think about. By choosing which events to cover and in what way, media outlets decide what issues are on the public agenda. A tributary to agenda-setting theory is framing theory, which seeks to establish the different ways in which media coverage leans in a particular direction, for example through the use of certain talking points or phrasing.
Second, gate-keeping theory sees media outlets as, well, gate-keepers who are in control of the flow of information. The media serve as a filter, as it were, for making sense of the unordered blob of events and occurrences that make up our daily life. Gate-keeping theorists come in different stripes. Some emphasise the importance of journalists' personal preferences and biases for deciding what information makes it through the gate (similar to agenda-setting theory). Others see more value in looking at the salience of individual unfolding events, editorial decision-making processes, or market incentives. Gate-keeping theory becomes even more complex when you look at online media, because gated walls become much more porous in a large, interactive network.
Finally, there are theorists who study the political dimension of mass media. A famous example of this is Edward Herman and Noam Chomsky's propaganda model. Herman and Chomsky argue that the very structure of the capitalist system ensures a media coverage bias in favour of the pro-corporate, capitalist status quo. They emphasise the importance of ownership structures and advertiser incentives; a company is unlikely to advertise on a channel with an anti-consumerist slant, which means less ad revenue, which means bankruptcy. This overarching media bias ensures that, although freedom of the press exists, counter-capitalist narratives can never gain enough salience among the public to truly upset the status quo.
Personally, I am somewhat on the low-influence side of the spectrum. I certainly believe that the media, as a collective, have tremendous power over what we think and talk about. However, in this era of unimpeded global flows of information we can no longer speak of the media as a homogeneous entity. The barrier to accessing any media outlet you like has become lower than ever. It's not hard to find a community of people who agree with you in comment sections, forums, and on social media. So instead of the media being the prime mover of public opinion, the ubiquity of information gently pushes us into ideologically self-inforcing bubbles, where we can provide feedback to content creators and freely discuss the news with others. This is not to say that content does not matter; the media do, in my view, still set the agenda and decide what issues become important for us to talk about. Furthermore, the political dimension should not be ignored; overt and covert propaganda are arguably more prevalent in society today than at any point in the last 20 years. However, the news is discussed and challenged more and more in this era of new media. Audiences have an unprecedented say in shaping media content, and whatever risks that may bring (see this question about citizen journalism), it does imply a significant change in how audience members view the role of media in their lives, and how we incorporate the information we receive.