Why isn't there random effect? I'm trying to use lme4::glmer to fit a mixed model such like that:
library(lme4)
set.seed(123)
df<-data.frame(id=sample(LETTERS[1:10], 50, T),
               y=rbinom(50, 1, 0.3),
               x1=rbinom(50, 1, 0.5),
               x2=as.integer(rnorm(50, 40, 5)))
df<-df[order(df$id),]

fitm<-glmer(y~x1+x2+(1|id), data=df, binomial)

coef(fitm)
$id
  (Intercept)    x1       x2
A      -1.009 1.239 -0.01631
B      -1.009 1.239 -0.01631
C      -1.009 1.239 -0.01631
D      -1.009 1.239 -0.01631
E      -1.009 1.239 -0.01631
F      -1.009 1.239 -0.01631
G      -1.009 1.239 -0.01631
H      -1.009 1.239 -0.01631
I      -1.009 1.239 -0.01631
J      -1.009 1.239 -0.01631

I'm wondering why the effects are identical across ids. Why isn't there random effect as expected? Note, the glmer's out is exactly same as using glm here:
fitg<-glm(y~x1+x2, data=df, binomial)
coef(fitg)
(Intercept)          x1          x2 
   -1.00861     1.23882    -0.01631

 A: Your outcome is not correlated with your id variable, so the results would look essentially the same with/without the random effects due to the fact that no significant relationship exists between the two. 
Random effects are often included to account for correlation between the outcome and some covariate (here ID), for example when several measurements are taken from the same individual, we want to account for the fact that each individuals observed measurements are likely to be similar.
Since you have selected all of your covariates at random, and have not included any correlation between the outcome and ID, there is no need for the random effect and it would not be significant within the model.
A slightly edited example to your previous:
library(lme4)
set.seed(12345)
df<-data.frame(id=sample(LETTERS[1:2], 1000, T),
           x1=rbinom(1000, 1, 0.5),
           x2=as.integer(rnorm(1000, 40, 5)))

df$y<-ifelse(df$id=="A",rbinom(1000,1,prob=0.85),rbinom(1000,1,prob=0.4))

df<-df[order(df$id),]
fitm<-glmer(y~x1+x2+(1|id), data=df, binomial)

coef(fitm)
$id
(Intercept)        x1          x2
A    2.157210 0.4023013 -0.01144187
B   -0.117885 0.4023013 -0.01144187  

coef(glm(y~x1+x2,data=df,binomial))
(Intercept)          x1          x2 
 1.05255753  0.33669182 -0.01792981

