I agree with Kurokiku: research is key. I recommend looking through different illnesses that fit what you're trying to achieve with your character, choose one that fits best, and then look up everything you can on said illness. Medical websites that originate from hospitals or health care centers are probably the best thing to go to, since you're more likely to get genuine information rather than just opinions. It would also help to look up testimonies - articles/interviews where someone who has said illness is explaining how it affects their daily life.
Your character's history should reflect how the illness has impacted your characters ability to learn, socialize, and perform everyday activities. For example, one of my characters has Asperger's Syndrome, which affects one's ability to socialize and communicate with other people. He's very awkward - stutters often when he speaks, has a hard time controlling his volume, and doesn't do well with meeting new people. Your character's personality traits should also reflect your character's illness, for example, if they have Schizophrenia, maybe they tend to go on long rants or talk to themselves for long periods of time. If they're mentally challenged, perhaps they trust others too easily or don't catch on to regularly used non-verbal cues.
Once you've gotten the hang of what your character's illness is and how it affects them as a person, its pretty easy to write for them. Just be careful to avoid stereotypes, they can make your character too generic, and can cause offense.