For me this maddening issue seems to be connected with Safari cookies as others suggested. Whenever I go to Safari and "Clear History and Website Data" from the History menu or "Remove All Website Data" from the Privacy pane in Safari Preferences, iTunes asks me to login when I open it.
The problem is, it's also tied to Safari cookie preference, also on on the Privacy pane. I hate web cookies and don't accept them unless I need to log in to a web site, but I found I had to enable cookies, at least until I logged into iTunes, then I could disable them. Unfortunately I have to do this same song and dance everytime I clear my safari cache.
My answer to this annoying iTunes issue? Set Safari to accept cookies and then never use it for web browsing since I don't want to accept cookies.
I think its ridiculous that Apple requires me to accept cookies in Safari just so I can use iTunes. It's like some lazy third grader designed their software.
<rant>This is why I stopped using Safari in the first place: they don't have cookie prompting like every other legitimate browser in the known universe, and its current cookie preferences are inadequate to say the least. "Allow from current website only" doesn't do what it says because I always manage to get cookies set for ad trackers and other stalkerware so I just stopped accepting them altogether because I don't always want to accept cookies even from sites I visit. But, since Apple decided to link iTunes with Safari cookies, I can't do that so I stopped using Safari altogether. I would LOVE to take advantage of Safari's Keychain integration and password generation features, but I cannot accept a browser that doesn't allow me to control which sites I accept cookies from. They seem to have adopted a neurotic "dumbing down" mentality in the name of "user friendliness" the last few years, and this convoluted cookie management and iTunes integration is just one example.</rant>