Flying is a technique that can be accomplished by using a rapid-fire weapon to send yourself in an upwards fashion using the recoil from the gun. It is easier to fly in a low-gravity environment, or using high ledges.
To fly, jump up and press the button 'X' (similar to the 'old-school' selfboost) and fire downwards with a weapon. The best weapons for this are the Minigun, Plasmagun, the M4A1, and the Ray Rifle; although you can still do this with any slot 2 weapon (excluding Alien Rifle, but the Alien Rifle + Alien Shotgun combo works fine). In low-gravity environments, you can also use the Heavy Railgun to achieve high altitudes. Rocket-jumping, BNG-jumping and grenade-jumping can also be used to fly.
Flying can also be turned into a long-distance glide, usually with horrendous results (flying at near-light speed and driving yourself several meters into walls), by getting a running start, jumping, and holding X while holding the left mouse button with nothing equipped.
However, this type of flying is a glitch/exploit and some players may turn against you if you'd abuse it.