Is "ought to" still used in modern English? If yes, in what contexts is it used, and is it used more in formal or informal cases?
Yes, it is. Quite a bit, in fact.
That’s an interesting question, because it turns out that ought can sometimes be quite formal, but it can sometimes be quite informal. It just depends how it’s used. Here are two examples from opposite ends of that register spectrum:
The simple answer to your question is that ought gets used all the time, in all registers and speakers. It’s a perfectly normal word for expressing either obligation or probability. It is one of the lighter in strength of several nuanced alternatives in this list:
Whether the first or the second of those is the stronger in obligation depends on the speaker, but I have ordered them according to my own somewhat nebulous perception of increasing strength.
Like its close cousin should, modal ought also has a second sense having nothing to do with obligation, but only of possibility / probability / likelihood:
Those four are all about likelihood or probability, not obligation. The speaker believes it varyingly possible, or even probable, that they will have enough by then.
“Ought to” is so commonly used that you’ll sometimes see it written as “outta”, “oughta”, or “oughtta” by writers attempting to write in dialect, such as “Hey Mack, ya really outta getcherself a new broad!”
Ought works mostly like a modal auxiliary, no more admitting words like do, had, or will to the verb phrase than one involving should would. That’s because, per the OED, “as an auxiliary of predication it has become indefinite as to time.” These are therefore all ungrammatical in standard English:
Although some of those do occur in some speakers, they are considered highly non-standard, and would convey a very strong rustic or unlettered tone to any character in whose mouth you put such words. Indeed, the OED even goes so far as to label “did ought” as dialectic, colloquial, and vulgar, which is about as harsh a condemnation as it ever makes. Here’s one of its citations for this sort of “vulgarity” (in the classical sense :):
Obviously that speaker has other markers of education or station, such as the non-standard “I done”, reinforcing the picture we are to have of them.
In contrast, speakers who naturally use double modals (like “might should”) will do the same with ought, forming such constructs as might ought to. Since these are not ungrammatical in those speakers, constructions such as this one become possible: “You might ought to do something about that tire.” In contrast to the previous example, this one sounds merely folksy to my hear, not ungrammatical.
In my own particular flavor of English, whenever ought is used in the negative, the to particle in front of the following infinitive is always suppressed, making it in form just like the modal shouldn’t:
In the same way, for me the to is also suppressed when used in question inversion, although question inversion with ought sounds rather formal, perhaps even stuffy:
I can’t imagine it gets used much in first-person singular, perhaps because there are plenty of alternatives that come more readily to the tongue:
In this regard of suppressing a following to under negation or inversion, modal ought behaves like modal need, which is also somewhat more formal-sounding:
From a purely syntactic viewpoint, you can swap in ought for need in both examples above without changing anything else. Regarding to-suppression, the Wiktionary entry for ought has this in its usage notes:
I do not know the geographic distribution of the to-suppression portions of Anglophonia, but it has been suggested that there are British speakers who require the to and American speakers who forbid it. If so, it may be that this is another one of those many forms of speech prevalent during colonization that wound up better preserved abroad than in Britain itself. Certainly there are plenty of citations of to-suppression in English literature from the 16th through the 19th centuries; here are a few from the OED:
To my ear, the Milton and the Browning sound archaic, having to-suppression in the positive, but those in the negative sound normal (as least insofar as the ought use is concerned). I don’t know why suppressing the to particle sounds slightly archaic when in the positive, but not at all so in the negative or under inversion, but it does.
The only completely obsolete use of ought that I am aware of is using it as the simple past tense of to owe. This is a non-modal use and so is subject to inflexions. The OED lists examples of oughteth, oughted, oughting, and says that all such use is either obsolete or dialectic, allowing for an apparently non-obsolete Scots use such as:
Or is that now also obsolete even in Scotland? I don’t know whether there are any Scots who might still say such a thing; perhaps so. But the rest of us would say “We owed him” there.
It is always interesting to read what individual native speakers of different English dialects think of this or that word or construction. However, even an educated native speaker with some background in linguistics can share his or her opinion that does not necessarily coincide with observable general trends/rules. To answer a question like this, one needs to do some research.
Incidentally, the Longman Grammar of Spoken and Written English is the bible for anyone who is seriously interested in descriptive English grammar. Obviously, it takes a bit longer to produce such a work than googling.
Now about the marginal modal "ought to". Unsurprisingly, it is pretty rare (breaking news!). It is not among the nine most frequent modal verbs (will, would, can, could, may, should, must, might, and shall). The verb "ought to" is (generally) so rare compared with other modal verbs that the authors of LGSWE decided to exclude it from most figures and even discussion in their grammar. That's why Geoffrey Leech said that
Here are two illustrative tables from Leech 2003:
There is nothing surprising in these tables (i.e. that "ought" has been on the decline). Linguists have known this for at least fifty years. The general consensus among linguists is that "ought" is falling out of use (Cappelle and Desutter 2010, Collins 2009, Myhill 1997, among many, many others). In fact, I don't know of any linguist who would argue the opposite.
Martin Harris (in Harris 1986) shares a funny story about how his two teenage sons, "speakers of educated standard British English", "informed" him that ought is "an old word", used by people like him, meaning should (p. 347). That was in England in the 1980s.
In any natural language, there is a lot of variation. Some native speakers use "should" instead of "ought" in questions and negative sentences, some say things like "did we ought to leave so soon". Some native speakers say "oughtn't to open"; some, esp. in the US, say "oughtn't open", and some prefer "didn't ought to open". Some people think that "ought" should be used in cases when your judgment is based on external rules, like social conventions or institutions, as opposed to "should" used for the moral judgment stemming from the speaker's/writer's own personal criteria (Bouscaren et al. 1992). Some don't.
DeCapua 2008 argues that "use and choice of modals also vary somewhat regionally across the United States. In some areas, for instance, ought to occurs more frequently than in others [emphasis mine - Alex B.]" (p. 233).
However, we can observe general, supra-dialectal trends:
The authors of the MW Dictionary of English Usage, "the finest work of scholarship on English grammar and usage I have ever seen" (Geoffrey Pullum), mention that oughtn't is regionally limited in the US, "being found most commonly in Midland and Southern areas of the Atlantic Seaboard and in parts of the Northern Midland area." They also argue, based on thorough research, that oughtn't has "somewhat limited use in writing, mostly in reported speech or light prose."
Incidentally, Pam Peter's Guide is well-written and based on current linguistic research. David Crystal calls it "a reliable style guide."
Now, this is what Pam Peters actually wrote in the Cambridge Guide:
Other answers have mostly finished off your questions about contexts where ought to is used, and whether it's used more in formal or informal cases. Peter Shor, Alex B, and tchrist mention the regional form didn't ought to. Tchrist also mentions hadn't ought and might ought to, and notes that the OED says did ought is dialectic, colloquial, and vulgar.
Should ought to is another form sometimes seen (ref. ngrams). In transcriptions it's often rendered as should oughta or more tersely. Here's a should ought to of example, ca. 1914-1919, from You Know Me Al, by Ring Lardner. It represents colloquial or untutored midwestern US letter-writing of the time, perhaps exaggerated:
On page 354 of Modality in Contemporary English, S. J. Nagle comments on linguistics issues raised by should ought to, might should ought to, might should better, etc., apparently discussing whether these fall within some double- or multiple-modals system or instead are anarchic.
Pam Peters writes in The Cambridge Guide to English Usage (2004):
Use ought to when you wish to emphasize that:
I think ought to is slightly more formal but only in the very nature that it adds emphasis without invoking vulgarity, and that's usually formal.
Here is an example,