When incorporating mental illness into a piece of literature, the most important tool you need to use is research. This is true whether you want the mental illness to play a large part OR a small one, and it is true whether you know someone with mental illness or not. In fact, it's even true if you have the illness yourself, because no two people are the same, and your character may display different facets to you due to contributing factors like experience and personality.
That said, research is not the first thing you should do, because before you get stuck into that research, you need to look at WHY you want to include mental illness in your literature. If you think it would be cool or fun, you might want to rethink it unless you're prepared to put in a lot of work because living with mental illness is not either of those things (generally) and what you're doing for a bit of fun has the potential to negatively impact someone else's life in a big way because stigma & misrepresentation cause huge difficulties in the lives of people with mental illness. No matter what your reason is, you're in for a lot of work because, as I mentioned earlier, research is crucial when it comes to including realistic mental illness in your work.
So. Research. Read professional articles on mental illness in general and the specific disorder(s) you are thinking of using, and read personal articles on those as well. Talk to people with mental illness, listen to their stories and really hear their experiences. Find out what treatment options are appropriate ad whether they're offered in your setting (ie, if you're setting something in Gavle [Sweden], research what treatment options are available in Gavle, not what treatment options are available in YOUR location. Research common, possible and impossible illness combinations. Chances are if your character has Borderline Personality Disorder, she has at least one other diagnosis as well; on the other hand your Australian character with bipolar disorder and schizophrenia is stretching the bounds of believability.
Here are five key things you need to understand about mental illness. Some will have been mentioned previously, but they're getting reiterated because they really are important.
1. Mental illnesses are not "one size fits all" - not every person who has compulsions to wash their hands regularly has OCD, and not every person with OCD has regular compulsions to wash their hands regularly. Stereotypes might give you something to work from, but they are not always accurate portrayals of life with mental illness.
2. People who live with mental illness are not stupid. This one's really important, guys. If you want to include a character with low IQ, that's fine, but please think really hard before making it a character who also has an unconnected mental illness.
3. Mental illnesses born from traumatic experiences are not colourful and cute. People who have them do not tend to announce their disorder to complete strangers as a cheerful, pretty thing - in fact, they generally will not announce them to total strangers at all. Turning mental illness into a joke is incredibly risky, and doing it badly is dangerous for people who live with those conditions.
4. People who live with mental illness are not defined by their disorder(s). There are so many more aspects to us than just what we have been diagnosed with, and when you define your characters by their disorder, you are missing out on so much more character development and believability.
5. Mental illness does not simply disappear for no reason. Treatment may 'cure' certain types of mental illness, but others do not have a cure. Know what works and doesn't work for the disorder(s) in question and make sure the illness is not cured by love, unlikely treatment options or the death of a figure at the heart of the character's trauma. It really doesn't work that way.
Essentially, treat your character like a person and not a disorder; people are complex, varied creatures and that needs to be shown in your writing or your mentally ill character will come across as a caricature or worse.