A barrel roll can only be done in plane. Either hold left or right on the control-stick while pressing the "R"-button two times. When you hold left, then you do a left barrel roll. When you hold right, you do a right barrel roll. This means that you do a barrel roll to the left or right side.
+
You can get really fast speeds with a barrel roll, when you release the "A"-button while you do a barrel roll. But it's hard to control your vehicle during a barrel roll, so usually it's only used on straights.