Sonar
This is generally done using a Fourier transform to show the different frequencies making up the sound. Since every engine makes a specific sound, it is straightforward to identify the object. Databases of unique engine sounds are part of what is known as acoustic intelligence or ACINT.
Another use of passive sonar is to determine the target's trajectory. This process is called target motion analysis (TMA), and the resultant "solution" is the target's range, course, and speed. TMA is done by marking from which direction the sound comes at different times, and comparing the motion with that of the operator's own ship. Changes in relative motion are analyzed using standard geometrical techniques along with some assumptions about limiting cases.
Passive sonar is stealthy and very useful. However, it requires high-tech electronic components and is costly. It is generally deployed on expensive ships in the form of arrays to enhance detection. Surface ships use it to good effect; it is even better used by submarines, and it is also used by airplanes and helicopters, mostly to a "surprise effect", since submarines can hide under thermal layers. If a submarine's commander believes he is alone, he may bring his boat closer to the surface and be easier to detect, or go deeper and faster, and thus make more sound.
Examples of sonar applications in military use are given below.  Many of the civil uses given in the following section may also be applicable to naval use.

Anti-submarine warfare: Until recently, ship sonars were usually made with hull mounted arrays, either amidships or at the bow.  It was soon found after their initial use that a means of reducing flow noise was required.  The first were made of canvas on a framework, then steel ones were used.  Now domes are usually made of reinforced plastic or pressurized rubber.  Such sonars are primarily active in operation.  An example of a conventional hull mounted sonar is the SQS-56.
Because of the problems of ship noise, towed sonars are also used.  These have the advantage of being able to be placed deeper in the water, but have limitations on their use in shallow water.  These are called towed arrays (linear) or variable depth sonars (VDS) with 2/3D arrays.  A problem is that the winches required to deploy/recover them are large and expensive.  VDS sets are primarily active in operation, while towed arrays are passive.
An example of a modern active-passive ship towed sonar is Sonar 2087 made by Thales Underwater Systems.

Torpedoes: Modern torpedoes are generally fitted with an active/passive sonar.  This may be used to home directly on the target, but wake homing torpedoes are also used.  An early example of an acoustic homer was the Mark 37 torpedo.
Torpedo countermeasures can be towed or free.  An early example was the German Sieglinde device while the Bold was a chemical device.  A widely used US device was the towed AN/SLQ-25 Nixie while the mobile submarine simulator (MOSS) was a free device. A modern alternative to the Nixie system is the UK Royal Navy S2170 Surface Ship Torpedo Defence system.

Mines: Mines may be fitted with a sonar to detect, localize and recognize the required target.  An example is the CAPTOR mine.

Mine countermeasures: Mine countermeasure (MCM) sonar, sometimes called "mine and obstacle avoidance sonar (MOAS)", is a specialized type of sonar used for detecting small objects.  Most MCM sonars are hull mounted but a few types are VDS design.  An example of a hull mounted MCM sonar is the Type 2193 while the SQQ-32 mine-hunting sonar and Type 2093 systems are VDS designs.

Submarine navigation: Submarines rely on sonar to a greater extent than surface ships as they cannot use radar in water.  The sonar arrays may be hull mounted or towed.  Information fitted on typical fits is given in Oyashio-class submarine and Swiftsure-class submarine.

Aircraft: Helicopters can be used for antisubmarine warfare by deploying fields of active-passive sonobuoys or can operate dipping sonar, such as the AQS-13.  Fixed wing aircraft can also deploy sonobuoys and have greater endurance and capacity to deploy them.  Processing from the sonobuoys or dipping sonar can be on the aircraft or on ship.  Dipping sonar has the advantage of being deployable to depths appropriate to daily conditions. Helicopters have also been used for mine countermeasure missions using towed sonars such as the AQS-20A.

Underwater communications: Dedicated sonars can be fitted to ships and submarines for underwater communication.

Ocean surveillance: The United States began a system of passive, fixed ocean surveillance systems in 1950 with the classified name Sound Surveillance System (SOSUS) with American Telephone and Telegraph Company (AT&T), with its Bell Laboratories research and Western Electric manufacturing entities being contracted for development and installation. The systems exploited the SOFAR channel, also known as the deep sound channel, where a sound speed minimum creates a waveguide in which low frequency sound travels thousands of miles. Analysis was based on an AT&T sound spectrograph, which converted sound into a visual spectrogram representing a time–frequency analysis of sound that was developed for speech analysis and modified to analyze low-frequency underwater sounds. That process was Low Frequency Analysis and Recording and the equipment was termed the Low Frequency Analyzer and Recorder, both with the acronym LOFAR. LOFAR research was termed Jezebel and led to usage in air and surface systems, particularly sonobuoys using the process and sometimes using "Jezebel" in their name. The proposed system offered such promise of long-range submarine detection that the Navy ordered immediate moves for implementation.

Between installation of a test array followed by a full scale, forty element, prototype operational array in 1951 and 1958 systems were installed in the Atlantic and then the Pacific under the unclassified name Project Caesar. The original systems were terminated at classified shore stations designated Naval Facility (NAVFAC) explained as engaging in "ocean research" to cover their classified mission. The system was upgraded multiple times with more advanced cable allowing the arrays to be installed in ocean basins and upgraded processing. The shore stations were eliminated in a process of consolidation and rerouting the arrays to central processing centers into the 1990s. In 1985, with new mobile arrays and other systems becoming operational the collective system name was changed to Integrated Undersea Surveillance System (IUSS). In 1991 the mission of the system was declassified. The year before IUSS insignia were authorized for wear. Access was granted to some systems for scientific research.
A similar system is believed to have been operated by the Soviet Union.

Underwater security: Sonar can be used to detect frogmen and other scuba divers.  This can be applicable around ships or at entrances to ports.  Active sonar can also be used as a deterrent and/or disablement mechanism.  One such device is the Cerberus system.

Hand-held sonar: Limpet mine imaging sonar (LIMIS) is a hand-held or ROV-mounted imaging sonar designed for patrol divers (combat frogmen or clearance divers) to look for limpet mines in low visibility water.
The LUIS is another imaging sonar for use by a diver.
Integrated navigation sonar system (INSS) is a small flashlight-shaped handheld sonar for divers that displays range.

Intercept sonar: This is a sonar designed to detect and locate the transmissions from hostile active sonars.  An example of this is the Type 2082 fitted on the British Vanguard-class submarines.

Civilian applications: 

Fisheries: Fishing is an important industry that is seeing growing demand, but world catch tonnage is falling as a result of serious resource problems. The industry faces a future of continuing worldwide consolidation until a point of sustainability can be reached. However, the consolidation of the fishing fleets are driving increased demands for sophisticated fish finding electronics such as sensors, sounders and sonars.  Historically, fishermen have used many different techniques to find and harvest fish. However, acoustic technology has been one of the most important driving forces behind the development of the modern commercial fisheries.
Sound waves travel differently through fish than through water because a fish's air-filled swim bladder has a different density than seawater. This density difference allows the detection of schools of fish by using reflected sound. Acoustic technology is especially well suited for underwater applications since sound travels farther and faster underwater than in air. Today, commercial fishing vessels rely almost completely on acoustic sonar and sounders to detect fish. Fishermen also use active sonar and echo sounder technology to determine water depth, bottom contour, and bottom composition.

Companies such as eSonar, Raymarine, Marport Canada, Wesmar, Furuno, Krupp, and Simrad make a variety of sonar and acoustic instruments for the deep sea commercial fishing industry. For example, net sensors take various underwater measurements and transmit the information back to a receiver on board a vessel. Each sensor is equipped with one or more acoustic transducers depending on its specific function. Data is transmitted from the sensors using wireless acoustic telemetry and is received by a hull mounted hydrophone. The analog signals are decoded and converted by a digital acoustic receiver into data which is transmitted to a bridge computer for graphical display on a high resolution monitor.