"There" is a dummy pronoun that functions as the subject of the sentence. It's often called 'existential there'. The basic non-existential version would be "A nail was in my shoe".
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.