The way it works is by taking your MMR, an invisible number attached to your account, and placing you with/against other players who share a similar MMR.
MMR is determined by how many games you've won compared to how many games you've lost. In normals, this means if you have dominated tons and tons of games, you'll find yourself playing with people who are potentially higher than what you may be in ranked. For instance, my normal MMR pairs me often with players who are in mid-high gold, and sometimes low platinum, despite being in Silver II, because my win ratio bumped up my MMR.
In ranked queues, it's totally different. MMR for ranked is (as far as I know) completely unrelated to your normal MMR, and is originally determined by your rank. Of course, you have the potential to bump up your MMR here just like in normals, and if you're incredibly high above the average, it is possible to skip entire divisions. Generally speaking though, the system tries hard to ascertain that you are playing with people that are both within your skill level and at least relatively close to your current division.