Mixed Finite Elements, Compatibility Conditions, and Applications