  In this paper, we import the theory of "Calabi-Yau" algebras and categories
from symplectic topology and topological field theories to the setting of
spectra in stable homotopy theory. Twistings in this theory will be
particularly important. There will be two types of Calabi-Yau structures in the
setting of ring spectra: one that applies to compact algebras and one that
applies to smooth algebras. The main application of twisted compact Calabi-Yau
ring spectra that we will study is to describe, prove, and explain a certain
duality phenomenon in string topology. This is a duality between the manifold
string topology of Chas-Sullivan and the Lie group string topology of
Chataur-Menichi. This will extend and generalize work of Gruher. Then,
generalizing work of the first author and Jones, we show how the gauge group of
the principal bundle acts on this compact Calabi-Yau structure, and compute
some explicit examples. We then extend the notion of the Calabi-Yau structure
to smooth ring spectra, and prove that Thom ring spectra of (virtual) bundles
over the loop space, $\Omega M$, have this structure. In the case when $M$ is a
sphere we will use these twisted smooth Calabi-Yau ring spectra to study
Lagrangian immersions of the sphere into its cotangent bundle. We recast the
work of Abouzaid-Kragh to show that the topological Hochschild homology of the
Thom ring spectrum induced by the $h$-principle classifying map of the
Lagrangian immersion, detects whether that immersion can be Lagrangian isotopic
to an embedding. We then compute some examples. Finally, we interpret these
Calabi-Yau structures directly in terms of topological Hochschild homology and
cohomology.
