Effective medium theory of sub-wavelength metallic, polaritonic and dielectric nanostructures that encompasses their electric, magnetic and magneto-electric response at optical frequencies is introduced.Theory development is motivated by the recent surge of interest in electromagnetic metamaterials: nanostructured composites that may exhibit unusual or naturally unavailable electromagnetic properties. This work focuses on deeply sub-wavelength structures (with unit cell much smaller than wavelength), for which an electromagnetic homogenization theory is developed.The theory starts from purely electrostatic description of non-magnetic (metal-dielectric) composites and uses plasmon eigenfunctions as the basis.Magnetism and other retardation phenomena are taken into account as perturbations of electrostatic equations.Theoretic description is validated by experimental data on extraordinary optical transmission through sub-wavelength hole arrays in crystalline silicon carbide films.Itis shown that one of the most amazing applications of optical metamaterials, known as the superlens, enables deeply sub-wavelength spatial resolution not limited by Abbe''s resolution of a microscope.