One of my writer-friends has an ebook on "
Writing the Other."
My own tips for writing characters who aren't like you include:
1) Get to know other people who aren't like you. This makes it much easier to spot similarities and differences, to see and hear what kind of experiences they have that might diverge from your own. If you look at my audience, you'll see that there are people of various genders, nationalities, religions, socioeconomic backgrounds, sexual tastes, etc. That's not an accident.
2) Read literature written by people who aren't like you. Chances are they will be talking about some of the same things and some different things. Plus diverse literature can always use more support from shoppers. Some examples include
black literature,
women's literature,
queer literature,
Native American literature,
Jewish literature, etc.
3) Do your homework. If you plan to base a story on a character whose traits are very different, look for resources about those traits so that you can describe them plausibly. Learn how a given background or characteristic can influence someone's life. Try to identify hot-button issues and stereotypes.
4) Looping back to item #1, ask if any of your friends who are like your protagonist would be willing to serve as first-readers. That's a good way to catch mistakes before they can get onto an editor's desk, or worse, into print.