Any MIDI controller will work fine with SONAR. I would strongly urge you to try out any keyboard in person before buying, because it's a tactile device and how it
feels is everything.
1. How many keys do you need? You might assume a compact 25-key controller might be best and take up the least amount of space. But as soon as you try to play a sample library that has keyswitches, you'll realize your mistake. 49 keys is the bare minimum, 72 or 88 is ideal if space is not an issue.
2. Some controllers offer user-assignable knobs and sliders. These can be very handy. You can use them to move the virtual controls on your software synthesizer. Maybe you care about this, maybe you don't. Some people consider it an essential feature. Personally, I almost never use the feature and wouldn't miss it if it was gone.
3. Some controllers have between pressure pads for percussive input. Some are tiny and can be actuated by a single finger only, others are big enough you can play with two fingers or a stick. It's a fun way to manually play drum parts. However, the sensitivity of these pads is never quite right, either too sensitive or not sensitive enough.
4. Most controllers nowadays do not have an internal power supply. I don't like wall-warts. I'd glady pay a little more for a controller that had an internal power supply. Some don't have a power supply at all and are powered off the USB bus. I don't like that at all (except for my little miniature keyboard I carry around when I travel). In the studio, I use 5-pin DIN, so I'd have to plug in a USB cable just for power. One MIDI controller that I have (Axiom 49) can be powered via USB or a wall-wart, but the wall-wart cost extra and is not included, requiring a separate purchase.
5. Speaking of 5-pin DIN...that's the old-fashioned way of hooking up MIDI devices, and most folks nowadays use a USB connection instead. I, however, am a fan of the old way of doing it. Just in case you should discover the benefits of DIN connectors, make sure the controller you choose has them. Not all do, especially at the low end of the price range.
6. If you ever end up using your controller on stage, you'll want to be able to do patch changes and/or MIDI channel changes quickly. If the controller requires you to pull up a menu in an LCD window to change the MIDI channel, skip it. Look for a dedicated switch instead. Even more important, if your controller is less than full-size make sure it has dedicated buttons for transposing!
7. Some low-end controllers lack pitch and/or mod wheels. These are absolutely essential IMO. Do not accept a touch pad or joystick-type controller in place of wheels. Only a Moog-style pitch wheel (returns to center when you let go of it) and mod wheel will do. They should be ergonomically placed such that you can easily reach them with your left hand while playing the keyboard with your right. (One of my synths requires an awkward long reach to get to the wheels.) Wheels should not offer much resistance - on my Axiom, the pitch wheel's springs are too tense.
8. Some controllers include a basic transport control (play, stop, rewind, FF). That's a surprisingly useful feature if your MIDI controller isn't right next to your computer keyboard.
9. Another nice feature if you use the controller on stage is backlit knobs. One of my controllers has this and I wish all of them did. (Why do so many devices have black buttons on a black background with tiny off-white labels? Engineers that have never worked from a darkened stage, that's why.)
That's all I can think of off the top o' my head.