Well.. there are lots of ways to hack. It depends what you mean by ‘hack’ too. You used to be able to do stuff like send a website too much information calling to to fall over, and in falling over it would spill some interesting information… or you could send it loads of information which was in fact code that it would end up executing – so you put code in there that did something you wanted like gave you access or email you stuff for example.
There are loads of approaches. Actually gaining access to a system so you can use it like a normal computer is quite hard though afaik and rare, unless someone’s left part of it unsecured, they’ve chosen a stupid password, or you sleep with someone with access, and so on. Which happens a lot.