I've often done this using a jigsaw, with the bookcase face down, or before assembling it. I assumed you want sharp corners - jigsaws can cut fairly tight turns but not sharp. I wouldn't run the saw along a fence for this, though you could.
- Mark out the cutout on the back
- Drill a hole bigger than the blade (10mm or 3/8" works well) near but not at one edge.
- Saw, forming a smooth curve to meet the side, ending at a corner (maybe turn a bit sharper than I've drawn, but it's not to scale.
- Take out and reverse the saw to finish that side
- To cut the other sides, back the saw away from the corner, and make the turn onto the new side.
- Again, cut into the corner by turning the saw round.
You may need to sand a little where the cuts from opposite directions meet, but with practice that shouldn't be needed.
Jigsaws give the nicest finish if you work from the back, because they cut on the pull stroke so any tearing out is on the face you're working from. The sole blade can also leave marks.
Here's one I did with a jigsaw, to fit a UK double socket (but I've since moved the bookcase to another place).
That's Ikea Billy, so a reasonable particleboard with a fake wood veneer.