When a case is detected, the NSW government's contract tracers conduct confidential phone interviews to determine all contacts, both forward and backward. A forward contact is someone to whom you may have given the virus. A backward contact is someone from whom you may have received the virus. The "backward" contact is the more critical one, as it can lead to previously unknown community cases. The contact tracers are aiming to trace the new case back to an already known case. If they find any intermediate transmission or close contacts, they recursively do the forward/backward thing on the intermediaries and close contacts until they reach limits imposed by COVID's known incubation and infection times. The aim is to locate every person who has any chance of having COVID, given the known properties of COVID.
If the contact tracers successfully traverse the tree to all possible cases then lockdown is avoided. Close contacts are required to isolate at home for 14 days (with a support payment), whilst casual contacts are asked to get tested and monitor for symptoms. If the contact tracers are unable to traverse the tree or are overwhelmed by the numbers then a lockdown occurs. NSW has put significant resources into contact tracing as it recognises that the cost of a lockdown will always be greater than the spend on contact tracing.
Beyond phone interviews, contact tracing is assisted by a requirement for all public venues to keep a 14 day digital log of names, phone numbers and time of attendance of people who have visited. Patrons provide details on an honour basis, but most people do this honestly as they realise that it is their own interest to be contacted if they have been exposed to COVID. There's also a certain amount of pride that the country has weathered the storm (so far) and people don't want to be the one that stuffs it up.