Airlocks prevent unwanted flies and contaminants from entering your fermentation vessel while simultaneously allowing the gas that is created during fermentation to safely escape your fermentation vessel. Fill the bubbler with your favorite sanitizing solution or high proof alcohol. Be sure to keep an eye on any krausen/protein that may potentially clog your air lock. If this does happen, remove the air lock, clean it, refill with fresh sanitizer solution, and replace.
Three Piece vs S-Shaped Airlocks: It’s really a matter of preference. S-Shaped Airlocks are supposedly better at preventing sanitizer from being sucked into the fermenter during sudden temperature drops (although it will still happen). Three Piece Air Locks are easier to clean if they get dirty for any reason. Neither is inferior/superior, it’s just an option.
Tip: Use Fermcap to help prevent your krausen from overflowing/clogging your airlock.