Removing things from the oven halfway through is not very friendly to baked goods. In general, they'll collapse as they cool off since the structure isn't cooked and set, and the leavening (baking soda/powder in these cases) will be spent, so there's no way to get what you originally wanted. It might be something like what'd happen if you forgot the leavening in the first place.
In general: if there's only 5-15 minutes left, just leave it in, and the heat retained by the oven will take care of things. If it's barely started - just beginning to get warm, not bubbling/rising much - probably best to take it out and wait to bake later, especially if it's something that can survive waiting at room temperature. Anything else, leave it in and hope the power comes back; it's going to be ruined if you take it out and ruined if the power doesn't come back on so you might as well go for it.
So for example, cookies could probably survive this by leaving them in. They don't have very long baking times - somewhere in the 5-15 minute range. Your oven won't cool off all that much in that time without power. So if you leave them in for a little bit longer than the original baking time, they'll probably be fine. If your oven has a window, look in with a flashlight to check on them - you don't want to open it to check them.
A cake is iffier. If it's 15 minutes into a 45 minute baking time, you may just be out of luck. I think I'd still leave it in, hoping that the power comes back within 5-10 minutes, in which case it'd probably make it. As I mentioned earlier, if you lose power early and for long enough, the cake will have spent its leavening and collapsed. You could finish baking it, but it'll still be collapsed - it probably won't have a terribly palatable texture (definitely dense, maybe chewy).
The only time this has actually happened to me was with some cornbread muffins, around 2/3 of the way through their baking time, and the oven didn't have a window. I wildly guessed how much extra time to add, pulled them out then, and they were great. So there is hope!