The main differences between optimistic and zk rollup's are in how the validation or invalidation of a broadcasted rollup happens. In an optimistic rollup, the actors are assumed to behave in good faith, so all the published transactions to layer 1 will be considered valid until proven corrupted.
If there is any suspicion, a fraud-proof mechanism will take place. If the suspicion is confirmed, the transaction is eliminated, the state of the blockchain is reversed, and another transaction rollup with [assumed] uncorrupted transactions is published.
The ZK stands for Zero-Knowledge, meaning that the layer 1 does not need to know what is inside the rollup to introduce a new block, because a validity proof is provided by the zk layer.
The validity proof is a cryptographic hash that proves that the content of the transaction is legit and the new state of layer 1 will be correct.
In conclusion, layer 2 blockchains utilize either rollup solutions to scale blockchain networks by creating and computing big batches of transactions and then executing them off chain. The transactions are broadcasted to layer 1 blockchains for verification, thus inheriting the security and decentralization of layer 1.