How does the Room of Requirement work? Yes, I know it's magic, but is the Hogwarts castle itself sentient?
There is at least one piece of evidence that it is somewhat sentient.
When Neville in DH was hiding there and running out of food, the room responded by creating a NEW passage from Hogwarts to Hogsmeade, to Aberforth Hog's Head inn. Note that it picked just the right place where the owner would be sympathetic in addition to having food.
This could not possibly have been programmed in by Neville (who didn't think about just THAT solution to his hunger), nor by the original builder.
This problem solving is intelligence. Turing level. Heck, most humans would fail to find this solution.
I think that Hogwarts castle is partially sentient at the very least. Not only does the Room of Requirement operate on, essentially, Legilimency, but the castle as a whole seems to respond to and engage in human interactions with its inhabitants.
‘However,’ said Dumbledore, speaking very slowly and clearly, so that none of them could miss a word, ‘you will find that I will only truly have left this school when none here are loyal to me. You will also find that help will always be given at Hogwarts to those who ask for it.’
Chamber of Secrets - page 195 - Bloomsbury - chapter 14, Cornelius Fudge
A castle can't respond to a request for help if it's not sentient on some level. It's the same for the Room of Requirement, as far as canon has demonstrated.
‘Help me ... help me ...’ Harry thought, his eyes screwed tight under the Hat. ‘Please help me!’ [...]
A gleaming silver sword had appeared inside the Hat, its handle glittering with rubies the size of eggs.
Chamber of Secrets - page 235 - Bloomsbury - chapter 17, The Heir of Slytherin
As far as asking for help goes, for what it's worth, the consensus in Is the Sorting Hat necessary to ask Hogwarts for help? is that it is not the Sorting Hat that enables aid from Hogwarts, and by extension the Room of Requirement.
The room of requirement words by requiring necessity of use. That sounds complicated but Dobby explained it some.
The room's entrance must be passed three times (a magic number) while the person mentally focuses on what they need, then the room responds by magically creating the needed room.
In the case of Dumbledore's Army, they got into the same room by needing a place to train. \
For Neville he needed a place to hide out, then when he was running out of food the room created a passageway to an establishment in Hogsmeade that would give him food.
Harry accessed the room by accident when he was pacing back and forth trying to find a place to hide 'his' potion book (that was previously owned by Snape and filled with side notes).