This may come as a surprise to some people, but I have never shape-shifted into a bear.
Writing is full of sharing experiences that don't come from an author's personal history. Some of them are impossible to experience, like time travel, shape-shifting, magic and living on an intergalactic space ship. (That covers my personal wishlist.) Some can be learned, like how to fire a gun, pick a lock, cook a gourmet meal or play an instrument. And some can be observed and researched, like different cultures and groups.
An author doesn't have to be restricted to only what he or she knows and the key to expanding those horizons is research, research, research.
Creating the Impossible:
It might not be possible to travel in time, but an author can do the research to make certain that he or she has portrayed the historical period accurately. He or she can speak with physicists to learn about time as a fourth dimension. For magic, an author can study different magical systems across different cultures to get an idea of what we have believed is possible.
The key to creating something impossible that feels real to a reader is to set up a solid groundwork beforehand. Decide what the rules are going to be: does a character need to touch someone to get a psychic read or can they touch a photo? Does the space ship have artificial gravity or does it need to rotate to create the illusion of gravity? By setting up a framework, an author can avoid the temptation to suit the requirements to their story.
It's also critical to make sure that any big plot points have been set up properly. There are three common complaints in speculative fiction. The first is when authors tip their hands too much with an early "never do X" scene, making it obvious that X will be the solution to the big crisis. A classic example is Ghostbusters, where the characters are told to never cross the streams, but then have to cross the streams to defeat the big bad in the end. The second is when a useful ability or piece of technology is used initially and then never heard from again. The best example of this is in Iron Man, when the bad guy uses a device which emits a noise that immobilizes anyone who hears it. We never hear about this technology again, even though it would have been useful any number of times. The third is when the solution to the crisis isn't shown before the actual crisis. Someone reveals a new superpower or technology that would have been useful in the past. My favourite example of that is the "Oh yeah, R2-D2 can fly" moment from Star Wars: Revenge of the Sith.
For things which can be learned, the author has a different challenge. How many skills should an author acquire in the course of writing a book? With dozens of characters, each with their own skills, trying to learn them all could make it impossible to have the time to actually write the book. Each author has to find their own balance between research and writing.
Authors don't have to become experts in order to realistically portray a skill. Most experts are quite happy to share their expertise, and where possible, share some hands-on experience. For Inquisition, I spoke with police officers, prison guards, stage magicians and escape artists. I wanted to make sure I could realistically portray the skills and professions of my main characters and key secondary characters.
Writing about different cultures and subgroups is a touchy subject. No matter how diligent an author is in their research, he or she will never duplicate the experience of being in a different culture or subgroup. This is one of the main drives behind the #OwnVoices movement, which seeks to promote minority voice authors writing about their own cultures.
But at the same time, it's limiting to be restricted to writing characters which are all of a similar background to the author. And it creates an illusion of segregation and diminishes the presence of minority cultures and subgroups.
It's critical to do research, as much research as humanly possible. Speak to those within that culture or group, read books and articles about them and their experience, watch documentaries and whatever else an author can think of. An outsider's perspective will never be the same as an insider's, and there will always be differences between what the author portrays and what individual people have experienced. But if an author is sincere in wanting to portray a different culture with respect, it is incumbent on him or her to do the work to minimize those potential errors.
Using a sensitivity reader can also be a technique to minimize errors, but it isn't a replacement for proper research. A sensitivity reader is someone who is knowledgeable about a particular group or culture and who will read a manuscript in order to point out errors and things which could be offensive.
It can be intimidating to try and portray something which an author isn't familiar with, but with the proper work, it can open up a rewarding diverse landscape to explore.