What is the nature of the 7 demons in Mary of Magdalene that Jesus cast out? Luke 8:2 and Mark 16:9 mention that Mary Magdalene had seven demons, which Jesus exorcised.
In spiritual warfare literature, it's common to distinguish different types of demonic influence; example in the article The Extraordinary Actions of the Devil.  Another tries to give the following definitions:

Demonic Possession - It's when a demon takes over a person's body without their consent. It's what you see in most movies. It involves speaking in tongues, sudden personality changes, sudden violence, even superhuman strength.
Physical Pain - This is a sickness or an injury due to a demon being inside a person. It doesn't impact the soul, just the body.
Diabolic Oppression - This is when a demon torments a person, causing tragic events in their lives the loss of a loved one, the loss of a job, a home. Basically, the story of Job.
Diabolical Infestation - It's when demonic entities take over a house, an object, even an animal.
Diabolical Subjugation - It's when the possessed invites the demon into their lives. They do this through game play or pledging their soul to the devil. It's real in that if a human wants power, they can trade away their future for that power.
Diabolical Obsession - It's when a person has constant, overwhelming and irrational thoughts, making them act in perverse ways. It's hard to detect because it's the most highly functional of all the possessions. But it can lead to suicidal ideation and murder.

But today, especially in Western countries, people tend to &quot;psychologize&quot; those demonic influence into chronic depression, etc, such as how this article tries to contemporize Mary Magdalene's seven demons.
Rather than speculating from modern / Western lens or use Western categories (like the above), my complete question is: using the best studies of demonology in Jesus's time, what is the nature of the 7 demons oppressing Mary Magdalene in terms of how the Gospel writers would have conceptualized it?  In other words, what did the gospel writers have in mind when choosing the words to narrate what Jesus did?  Is it always a spiritual entity perceived to be gone out like in the Exorcist movie?  Or on the other extreme, is it an idiomatic expression for what today we call mental or physical illness?  Or is it something in between?
The significance of this question is to enable a more faithful interpretation of the many Gospel passages on Jesus and the Apostles casting out demons, which today's Christian groups (esp. those with Freedom ministries) use as the basis of their practice.  Some groups even take Mark 16:16-18 literally as the sign of a true believer (&quot;... in my name they will cast out demons...&quot;) and exhorting them to practice Jesus-given authority to regularly perceive demonic influence in yourself / others and exorcise them.
Preliminary research

A 2009 PhD Dissertation Jesus, A Jewish Galilean Exorcist: A Socio-Political and Anthropological Investigation by Amanda Witmer, McMaster University
Book Article Exorcism or Healing?: A Korean Preacher’s Re-Reading of Mark 5:1-20 by Sejong Chun (Vanderbilt University), reviewed here, part of the 2010 book Mark: Texts @ Contexts.  This paper contains 5 plausible hermeneutical understanding of the Mark 5:1-20 story, demonstrating the horizon of interpretation we are looking for in this question.
Demons and Politics: A Consideration of Jesus' Exorcisms in Mark a by Bible scholar Andrew Perry, pdf available here at his Academia site, commenting on three 20th century social study theories of exorcism discussed by Paul W. Hollenbach in his well-cited Journal of the American Religion 1981 article Jesus, Demoniacs, and Public Authorities: A Socio-Historical Study
2007 Master's Thesis The Representation and Role of Demon Possession in Mark by McGill Religious Studies student Eliza Rosenberg, which includes 15-page (!) list of works cited plus a 4-page list of modern exorcism accounts, mostly from news articles from 1995 to 2007.
What was Mary's infirmity
From a hermeneutics standpoint, the text really doesn't specify among the options listed in the OP.  The Greek word used in both places, δαιμόνια, is a pretty generic word for demons. (see here).
Perhaps the most detailed interpretation that could be read into the text comes from the preceding words in the same verse, Luke 8:2.  The verse in its entirety reads:

2 And certain women, which had been healed of evil spirits and
infirmities, Mary called Magdalene, out of whom went seven devils,

This suggests that Mary is one of the women who had been healed of &quot;evil spirits and infirmities&quot;, which could be just about anything.
Mental illness
It is not uncommon, as the OP noted, for mental illness to be postulated as an explanation for what the ancients were trying to describe in these circumstances (or at least in some of them).  What vocabulary would they have used to describe psychological infirmities?
For my own take on what the scriptures have to say about mental illness, see here.
For a more in-depth theological discussion of mental illness, SE-Christianity is probably more appropriate.
I will go ever-so-slightly beyond the scope of this site to draw a connection between Luke 4:40:

40 Now when the sun was setting, all they that had any sick with
divers diseases brought them unto him; and he laid his hands on every
one of them, and healed them.

&amp; John 13:15:

For I have given you an example

When Jesus encountered those who were infirm in body or mind He responded with compassion.  Society today often stigmatizes mental illness and would benefit from following Jesus' example.