Chemical equilibrium is the state of a reaction in which the rate of the forward reaction is equal to the rate of the reverse reaction. For instance, A + B > C. The rate at which A and B are combining to form C is equal to the rate at which C is decomposing into A and B. As Borek said above, the equilibrium constant is exactly that - a constant for specific temperatures. It changes at different temperatures because the rates of reactions change at certain temperatures. The equilibrium expression can be derived by rate laws, for example, knowing that the forward and reverse rates are equal it can be written that kf[A] = kr[C], which implies that kf/kr = [C]/([A]) and K = [C]/([A]). This is called the law of mass action, and if you want to understand its derivation even further it involves some highly complex math. Just be satisfied (for now) that it was derived using countless empirical data a long time ago before Rate Laws even existed.
The phases of individual reactants and products are important to equilibrium because there are different equilibrium constants for different phases. Solids are NOT incorporated into your equilibrium expression because the concentration of a solid is simply 1. For instance, if you were to say a solid has a concentration in mol/L, well, we know that moles are proportional to volume. Thus, if you increase the amount of moles of that solid, it's volume will increase proportionally, and thus its concentration remains 1. For gases, the equilibrium expression will make use of pressures. For aqueous reactants/products, the equilibrium expression will make use of concentrations in molarity or often times molality. It just depends.
Hopefully this answer helped you. :)