How to determine high availability configuration is working correctly
how does SQL know when to fail over


There is a Flexible Failover Policy which you can use to adjust the sensitivity to the criteria that will trigger a failover. The default is FAILURE_CONDITION_LEVEL = 3 which means "critical error, server unresponsive, or server down." You can see more details here and here.


  how would my application ... know where it is pointing


If your availability group listener is properly configured, the connection string should not need any further knowledge to always connect (even if after a retry) to the primary replica on a specific server - it does not need to know those implementation details at all. All it needs to do is point at the listener, and the listener determines if the primary replica is currently on DB01 or DB02. This is pretty powerful since it lets you adjust your AG configuration and move replicas all over the place without ever having to touch the applications (except in cases where you (a) add a replica with read-only intent or (b) have to move the listener). You can see more details here.