n-categories: foundations and applications