How do planes search for submarines?
Update. Added: much more informative P-8 diagram, sonobuoy diagram, ASW training film (see bottom), ESM, minor formatting fixes. Removed: consolidated two sonobuoy loading pics (linked but not shown inline).



This principle method of airborne sub-hunting is using sonar to search a wide area around your ships in the direction of advance. The intent is less tracking subs as it is to deter them from getting into a good position to shoot and/or obtaining a firing solution on your ships.

ASW is a long, complex topic (see bottom for USN training film). This answer will be brief unless someone has more questions.

Airborne sensors include:

Sonobuoys


Passive - (omnidirectional or directional) - subs are very quiet today. Detection ranges is extremely short. &lt;100 m by some accounts. 
Active - all subs are coated with anechoic tiles to absorb acoustic energy
A P-3 would go through about 10-30 buoys over a 6-10 hour mission
A P-8 can apparently cary 120 sonobuoys.
Some vendor specs are available.
GREAT video of sonobuoy deployment. (This is one type. Not all are this complex.) 

                
            



Source. Illustrator.


Alternate view #1. Alternate view #2. Credit. 

Dipping sonar

Unique to ASW helos

Credit: USN

MAD - magnetic anomaly detector

The large boom extending behind the tail:

Credit: DoD


looks for large metallic masses
limitations: short range (100s of meters), which requires aircraft to fly very low over the surface (increasing airframe fatigue and fuel consumption). Descending from cruising altitude also takes time. 
upside: good localization (spatial accuracy), relatively few false positives. 
downsides: Equipment is large and heavy. For these reasons, a MAD boom is not included on the current USN P-8, the navy's newest long range maritime patrol aircraft. 
Counter-measures: 


Sub can dive deeper to reduce their chances of being detected. Typical SSN operating depths are 400 m. The Type 214 claims a 700 m test depth. 
Some modern subs are made from non-magnetic steels (eg, German Type 212, Type 214) or titanium (Soviet Sierra, Alfa, and Papa class SSNs, portions of the Typhoon's 5 pressure hulls). 
Subs also undergo degaussing

LA-class USS Toledo (SSN-769) prepares to get underway after four days at the Magnetic Silencing Facility. 5 Feb 2010. Credit: USN



Radar


Historically, more useful for detecting subs on the surface, forcing them to spend more time underwater, where they were less effective (slower, limited endurance, limited sensor range). For much of WWII, German U-boats were essentially submersible torpedo boats. Most of their attacks were actually made on the surface. 
Today, our improved radars can detect submarine periscopes (and their wakes) at significant distances, forcing subs to take only very short glimpses. The periscope is actually quite useful for ID-ing targets and obtaining ranges and headings much more quickly than stalking with sonar alone. 


Signal intercept, ESM

You may detect a sub communicating over radio. You may also detect a sub if it uses its radar (very seldomly).

Visual

If you're directly above a sub at shallow depth, you can see it. Needless to say, this is extremely rare, but is one reason operating in shallow, littoral waters is dangerous. If you're lucky, you might spot a periscope wake. It's also unlikely you'll see a surface wake. At periscope depth, subs move very slowly. And at operating depths, surface wakes are extremely minute, likely undetectable even by radar and advanced processing, although attempts have been made.


Credit

EO/IR

General SA but may occasionally detect exhaust fumes (eg SSK snorkeling) or periscopes/wakes. 

Other non-acoustic methods


Chemical (eg hydrocarbon sensor) - to detect snorkeling subs recharging their batteries
LIDAR - potentially faster than MAD. Limited depth and search band. Less effective in turbid coastal waters. Not used operationally. 
Radar to detect the minute thermals from warm water heated by reactors. (Claimed by Russians, not demonstrated by US.)


Examples

Land-based maritime patrol aircraft examples: P-3 Orion (modded L-188 Electra), P-8 Poseidon, , 

P-8 Poseidon (modded 737-800ERX).


The Boeing 737 Technical Site. Source page with lots more info.

BAE Nimrod (based on the de Havilland Comet)


Source

Carrier based platforms include: S-3 Viking, SH-60 Seahawk

SH-60 Seahawk - sensors includes a variable-depth active/passive sonar, sonobuoys, and MAD. 


MAD bird (orange/red). Credit: DoD

Anti-submarine warfare intro

COORDINATED ASW PART 1 - Coordinated Anti-Submarine Warfare 2089 (HD version below)