Diagnostics in a technical context is the examination of a machine. But diagnostics in this context exceed this definition by far. Diagnostics comprises function monitoring, error detection, fault memory, activation, data acquisition etc. and is used for variant coding, end-of-line programming, reprogramming, identification etc.
Where does Diagnostics take place:
Diagnostic takes place in every ECU. The ECUs store information like e.g. their identifications, their vehicle identification numbers or diagnostic trouble codes.
How does Diagnostics work
In most of the cases an Off-Board Tester sends a Diagnostic Request to the ECU and the ECU sends back a Diagnostic Response. This can be a positive or a negative resonse. 
Diagnostics from Vector
DiagX, CANdesc and CANdescBasic are the three diagnostic components of Vector Informatik. DiagX is based on KWP2000-1, CANdesc and CANdescBasic is also available for UDS.