Multi-messenger and transient astrophysics with the Cherenkov Telescope Array