From Halopedia, the Halo wiki
Butterflying is a set of techniques Halo 2 and Halo 3 that use repeated melee cancels to move up and down and enable access to areas and routes that would not otherwise normally be possible. Historically this has also been known as wall climbing, as well as sword climbing for variants that use only the energy sword. Different variations can be performed in campaign and multiplayer.
This method requires two players who are not on the same team and can thus only be performed in multiplayer. Have one player (Person A) jump on top of the other player's (Person B's) head. Person A should repeatedly jump while standing on Person B. Person B should, while looking up at Person A rapidly press the melee and either action/reload or switch weapon ('B', 'X' and 'Y' respectively on the original Xbox). Effectively Person A will thus gain height by jumping and Person B will gain height by repeatedly lunging towards the other player but cancelling the melee attack in order to avoid killing them. If done correctly both players will rise vertically, reaching the tops of buildings and other areas.
If Person B uses switch weapon to cancel their melees they will need a secondary weapon but using action/reload the technique can be performed with only one weapon. An energy sword's lunge can also be used; to do this Person B will input fire ('RT' on the original Xbox) instead of melee but the trick will otherwise work the same.
An Expert and a Beginner
It is relatively easy for an expert and a beginner to perform the trick. Both Person A and their companion (Person B) should find a right-angle corner; Headlong has many such corners.
Person A should walk into the corner. Person B, the beginner, should jump onto Person A, and should continue jumping until they are stuck in the corner. When Person A is able to run around without causing Person B to fall, the trick may be performed.
Person A has to press A, B, and X in sequence as fast as possible. Person B must simply button-mash the A button. Note that for long climbs (such as when two players attempt to scale a tall building), Person A may have the additional task of moving forward into the building as they button-mash, to prevent Person B from slipping out of the corner. Ideally, a ruler or other item would be used to hold the thumbstick forward, so that both of Person A's hands are free to execute the button combination.
This method is almost identical to the first but rather than Person A pressing jump Person B does instead in addition to their melee cancels. With the original game's controls this means Person B rapidly presses 'B', 'Y', and 'A' repeatedly. This method requires a corner to perform as Person A will generally slide off of Person B's head and in addition with no surface behind Person B they pair of players will move backwards through the air. This method makes makes it easier for one player to perform the glitch with two controllers as they only need to handle one controller at a time. However it is also more limited due to the aforementioned issue of one player being prone to sliding off of the other.
Unlike the first method this method can be performed in campaign using an enemy AI. As the AI is not a human player however it is more difficult to get it on one's head. There are three ways to do this:
1: Lure the enemy into an area where it's AI no longer properly functions and where there is an edge from which it can fall and you can walk off of. Push the enemy to the edge so that it barely stands on it (you should see the enemy's foot sink into the ground slightly . Then walk off the edge and quickly spam melee and either action/reload or switch weapon. If done correctly the enemy will come off of the edge and you will fall together like a single object.
2. Push a preferably stationary enemy onto a slanted surface and get underneath it.
3. Lure the enemy to jump on your head; this is done best by having it jump from a higher surface than you are.
Once the enemy is on your head press melee, jump, and either action/reload or switch weapon repeatedly to ascend. You will rise up while gaining moving backwards and gaining speed. Spamming melee and action/reload or switch weapon but without the jump button will slow down your horizontal momentum and eventually cause you to descend. Descending in this manner will also bypass the fall timer allowing you to go down for as long as you keep inputting melee cancels although you will still be affected by death barriers. You can "detach" from your head by inputting crouch. If you are not moving horizontally (or not moving too quickly) you can catch the enemy back onto your head by melee cancelling at it once more. Repeatedly detaching and re-catching the enemy is the faster way to descend on the original Xbox version of the game. However in Halo 2 (Windows Vista) and Halo 2: Anniversary continuously spamming melee cancels is faster.
If you fly too fast horizontally the enemy will at some point fly off your head and this will leave you falling to your death. Conversely if you do not input 'B Y A' or 'B X A' fast enough the enemy will slowly slide away from you until it is level with you and you will likewise fall. This is mitigated by doing the inputs at a certain rhythm. An easy rhythm to use is to wait until right when the weapon drawing animation finishes before doing the inputs again. Even this however will eventually fail thus stopping your momentum with melee cancels before it happens is necessary.
Turning is possible though limited during this trick. However it is done entirely with the left thumbstick rather than the right one as meleeing towards the enemy will turn you face it's front (or in rare cases its rear).
In addition to exploration this method is used by speed runners on Uprising and High Charity to by pass the majority of the level and reach the end level trigger which exists from the start, as well as skipping the gondala rides on Delta Halo.
Butterflying in Halo 3 is largely identical to Halo 2's method 1. However in order to melee cancel in Halo 3 the player needs to have a weapon with a partly or fully emptied clip and ammo to reload with. Melee cancels and therefore butterflies cannot be performed using switching weapons nor can it be performed with the energy sword. Like in Halo 2 corners are generally easier to perform the trick on and at least having a wall helps as well. The default input for the person on melee cancelling is 'B RB'.
Butterflying is still possible in campaign; however it's usefulness has been diminished overall. Players can no longer input jumps during melee lunges and as such cannot lift enemies on their own. If the enemy's AI is still active then the player is also beholden to where the AI moves; this is contrast to Halo 2 where once the enemy is being moved in the air it will not do anything other than fire at the player if armed. Generally butterflying in campaign will allow players to "ride" the enemy character, particularly with those that can fly. For example speed runners butterfly on the back of drone on the level Crow's Nest during it's scripted path as this is faster than simply walking. Likewise it is somewhat possible to ride a sentinel around some of the pits on Halo.
Also referred to sometimes as "Butterflying" or "Butterfly Jumping," this glitch similarly allows two players to vertically gain height. Unlike the tricks listed in this article however, the Elevator glitch is performed without melee cancels and in fact does not even require that the players be on opposite teams. It is also entirely limited to corners in the map but can be performed identically in both campaign and multiplayer.