There are many ways to think of these definitions. Here's a way one can understand for example what $[\kappa]^2$ means and what it means to have a homogeneous subset, that I find intuitive.
Assume that you have a complete undirected graph with $\kappa$ many nodes. That means that you have $\kappa$ points and you connect every pair of them with a line. Now assume that we have two colours, red and blue, and that every line between two nodes is coloured either red or blue. A subset of these $\kappa$ nodes is called homogeneous if the lines between each and every of its nodes have the same colour (that's the same as saying that it has a complete subgraph whose lines are of one colour only).
Now we say that $\kappa\to(\lambda)^2$ is true if no matter how we paint those lines using two colours, we can find a homogeneous set of cardinality $\lambda$. That is, for every way we colour the lines we can find $\lambda$ many nodes that every line between them is of the same colour.
In other words, for every function $f:[\kappa]^2\to 2$ (you can think of this as a function that sends every two elements of $\kappa$ to one of the 2 colours) we can find a subset of $\kappa$ (let's call it$H$) that has cardinality $\lambda$ such that for every $x,y,z,w\in H$ we have $f(\{ x,y\} )=f(\{ z,w\} )$.
To generalize this if for every function $f:[\kappa]^n\to\mu$ (again you can see this as a function that sends every $n$ elements of $\kappa$ to one of the $\mu$ colours, or that it partitions the subsets of $\kappa$ of cardinality $n$ into $\mu$ partitions) we can find a set $H$ such that $\left|H\right|=\lambda$ and for every $x_1,\ldots,x_n,y_1,\ldots,y_n\in H$ we have $f(\{ x_1,\ldots,x_n\} )=f(\{ y_1,\ldots,y_n\} )$ then we say that $\kappa\to(\lambda)^n_\mu$ is true.
The arrow notation, even though appears weird at first is used because the property remains true if we replace the cardinal in the left side of the arrow with a larger cardinal or if we replace any cardinal in the right side of the arrow with a smaller cardinal (if the subscript in the left side of the arrow is omitted then it is assumed that it is 2). It should be obvious that the notation only has meaning if $\lambda<\kappa$.
There are many equivalent definitions of weakly compact cardinals. Jech's book mentions most of them, but here are some. If $\kappa$ is a cardinal then it is weakly compact iff:
$\kappa\to(\kappa)^2$ is true
$\kappa\to(\kappa)^n_\lambda$ where $\lambda<\kappa$ is true
$\kappa$ is inaccessible and has the tree property, that is, if you have a tree with height $\kappa$ and each level of the tree has less than $\kappa$ elements then it has a branch of length $\kappa$
$\kappa$ is $\Pi^1_1\textrm{-indescribable}$.
$\kappa$ is inaccessible and the languages $\mathcal{L}_{\kappa,\omega}$ satisfy the weak compactness theorem (hence the name). This means that in a language where we allow $\lambda$ conjunctions and disjunctions (where $\lambda<\kappa$), if we have a set of sentences $\Sigma$ where$\left|\Sigma\right|=\kappa$ and every subset of $\Sigma$ with less than $\kappa$ sentences is satisfiable then $\Sigma$ is satisfiable.