How to determine which cassettes I can use with my derailleur? I am trying to understand which cassettes I can install on my bike. I've understood that the length of the derailleur also determines which cassettes will fit.

In my case I have a triple (see picture below), with a 10-speed cassette, in the range 12-25. My experience with this cassette (and 30-tooth chainring) in the 18% stretches is not too pleasant. Therefore I am looking for options to replace it with a cassette with sprockets up to 27 or even 30 tooth. 



My main question is how I can determine which cassettes will fit on my bike. Even more I would appreciate a general answer, that explains what the limitations are of the derailleur when choosing cassettes, such that I can determine it myself.
You can't work out from first principles in advance what kind of cassette your derailleur will work with--you need to know the model, and then look that up to find out what Shimano's recommendations are. 

Daniel R Hicks describes how you can determine whether a cassette that you've already installed will work. 

"Tooth capacity" is also sometimes referred to as "chain wrap" or just "wrap." This is how much slack the derailleur can absorb; this is a function of the length of the derailleur cage (the distance between the jockey pulley and the tension pulley); the longer the cage, the more wrap. This is expressed as a number of teeth, figured as follows: 

(Big ring - little ring) + (big sprocket - little sprocket)


So if your bike has a 50/34 in front and a 12/25 in back, your derailleur needs to be able to wrap at least 29 teeth; if you switch to a cassette with a 30t low gear, you'd need 34 teeth of wrap.

I'm not sure about the exact derailleur you've got, but apparently Shimano has made some version of a 10-speed 105 derailleur (possibly newer and different from the 105 you have) where the short-cage model can handle 34t and the long-cage 40t. So you're probably OK.