Most will choose the trees, it's instinctual for them, but not always safe depending on your predator load.
If you want them to sleep in the coop they'll need to be trained/conditioned to coop up each night before the sun goes down and should never allowed to sleep in the trees to begin with. I herd mine in, some use herding sticks as extensions of their arms to help guide the birds in and get them to go where they need to go. I find that making the same call over and over every time you feed them from day one helps them correlate that word/call with FOOD, which helps immensely when you want to get them in. I can call my birds and they all come flying/running at me from all directions when I call them for treats at any time of the day,
You have to be consistent and make a nightly routine of it, sometimes it takes a couple weeks, sometimes it takes a couple months for the training/conditioning to grab hold of their little pea-brains... it depends on how consistent you are, and how stubborn the birds are, lol. Getting a treat each night in the coop helps.
Once it's a well established routine and they've learned to go in the coop for a treat and then get up on the roosts, they usually stick with it. All my birds are squawking at the pen gates wanting in at feeding time (before sundown) and if I am late... (I close my pens while the birds are out free ranging... so they can't come and go as they please for feed and also to keep wild life out to control disease)... I hear extra loud complaining and they don't hush til they have a beak full of treats to muffle the complaining, lol.