Octane ratings is basically a measure of when octane starts to detonate. The higher the number, the less prone it is to pre-ignition, ie knocking. Therefore the higher the number, the less likely the fuel is to detonate, and damage your motor.
There are 2 different ratings that have to be done. Research Octane and Motor Octane. Motor octane is rated with a pre-heated fuel mixture, and is therefore a lower number. I can't speak for everywhere, but fuel in Canada is rated at (R+M)/2, or the average between the Research Octane and Motor Octane numbers. Some plaves rate fuel my the research number alone, but I don't know where those places are.
Avaition fuel generally lists both numbers. A common aviation fuel is 100/130, which has a Motor Octane number of 100 and a Research Octane number of 130. If this were sold in the pumps at the gas station, it would have a 115 octane rating.
This fuel would take a lot more compression/cylinder pressure before it would preignite, and therefore you could run more boost before running into problems. The basic makeup of the fuel determines how much potential energy the fuel has. Gasoline has a certain amount of potential energy per litre, so the only way to make more power is to either use it more efficiently (higher compression) or simply burn more of it.
So higher octane fuel doesn't make more power. It allows your engine to make more power by allowing higher cylinder pressure, which generally means higher boost, which also translates to more air/fuel mixture.
If you run lean, it's just as bad, if not worse, because you are dealing with more potential energy. However, if you are running high octane fuel at an appropriate mixture, the worst case is that you won't make any more power because your engine isn't set up to make use of the higher octane fuel. (This is the same as running premium fuel in a car that isn't set up to need it. You get no power benefits, though you are safer in the event of an unexpected issue.)