Can someone explain why TCAS needs 2 antennas (one on the top of the fuselage and one on the bottom)? And why is the top one directional and the bottom one can be either omnidirectional or directional?
As @Ron mentioned the fuselage is an opaque obstacle for waves, and two antennas are required to cover the whole space around the aircraft. The choice is to have one antenna at the bottom of the fuselage and another one at the top. This is similar to SSR antennas, and actually SSR and TCAS, which share the same frequencies, can use the same antennas.
TCAS two-antenna system, source SKYBrary
When the bottom antenna sends interrogation pulses, these pulses can be reflected on the ground before reaching the intruder transponder, this very common effect is called multipath propagation, it can lead to false tracks, due to a wrong evaluation of the distance.
In addition it illuminates a large area below the aircraft down to the ground, this can trigger a lot of replies from other transponders, particularly from dense traffic at lower altitude, even if TCAS are inhibited at low very altitudes and on the ground, because TCAS also trigger mode C and S transponders. If a large number of replies reach the antenna at the same time, synchronous garbling is possible and some replies are not processed.
The solution is to use the top antenna as much as possible for long distance detection, and limit the bottom antenna to monitor intruders at shorter distance and below the aircraft. Other intruders are monitored by the top antenna. In practice, the lower antenna power is reduced.
Synchronous garbling reduction by whisper-shout
Different techniques are used to further limit garbling, as mentioned one is to reduce power when possible, and the protocol used by TCAS is to send pulses at low power more frequently than at hight power. This is known as the whisper-shout technique, and is also used for SSR.
Low power interrogations have a smaller effective radius and allow to get the short range picture, while the long range picture, which doesn't need to be refreshed as often, is obtained with high power interrogations.
However it is possible to further reduce synchronous garbling, specially at long range, by using directional interrogation pulses. While this technique is first used on the top antenna where is it most effective, it can also be used for the bottom antenna.
Synchronous garbling reduction by antenna directionality
The top antenna is made of at least 4 individual radiators which illuminate only 90°.
TCAS directional antenna, source
These individual antennas can be used together to form a radiation pattern in a given direction. This has two interests:
It reduces synchronous garbling on the antenna which is used most often. The effect is two-fold: In transmission, only aircraft in a 90° sector are interrogated; in reception replies from aircraft off sector are ignored.
It allows to determine the azimuth of a reply with some accuracy (1° to 10°). Sidelobes, also reduced by the antenna design, are used to refine azimuth processing.
See this document for more details.