1. Share a cohesive and inspiring vision for the project.
2. Understand your skills, strengths/weaknesses etc and try to give you work that challenges you / help you grow / are interesting.
I think these are rare and can be hard to do (I'm now trying to do it myself!), but when it happens it's very motivating.
I am aware that all of those things may not be in their power to give, but some combination of that in any org that is somewhat functional would be motivating.
I had another boss, a founder, who had a difficult relationship with engineering but was extremely gifted and had a great vision. I found myself highly motivated at this company as well, but for wholly different reasons. There are many paths to success.
Both startups had successful exits, and I felt as though I contributed meaningfully to both.